Thursday, September 20, 2012

program to display even natural numbers upto a limit

 program to display even natural numbers upto a limit

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i=0;
clrscr();   //it will clear the screen
printf("Enter the value\n");
scanf("%d",&n); //reads the limit value
while(i<=n)
{

printf("%d\n",i); //prints the number
i=i+2;   //incrementation of i by2
}
getch();
}

No comments:

Post a Comment