#include<stdio.h>
//int fact(int n)
//{
// //int sum = 1;
// if(n<=1)
// return 1;
//
// return n*fact(n-1);
//}
int main()
{
int code;
int i = 0;
printf("Enter 1 for even or Enter 2 for odd: ");
scanf("%d",&code);
switch(code)
{
case 1 :
{
while(i<100)
{
printf("%d\t",i);
i = i+2;
}
break;
}
case 2 :
{
for(i=1; i<=100; i=i+2)
{
printf("%d\t",i);
}
break;
}
defult:
{
printf("wrong input");
}
}
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.