Monday 9 January 2012

Print Even Number upto a range

#include<stdio.h>
#include<conio.h>

void main()
{
int n,i;
clrscr();
printf("Enter the Upperbound of the Range::\n");
scanf("%d",&n);
if(n<2)
{
printf("Can't Possible::\n");
}
else
{
printf("Even Numbers are ::");
for(i=2;i<=n;i++)
{
if(i%2==0)
printf("%d\n",i);
}
}
getch();
}

No comments:

Post a Comment