You are viewing a single comment's thread. Return to all comments →
void string(int a , int b, int n) { int i; for(i=a;i<=b;i++) { if(i>=1 && i<=9) { if(i==1) { printf("one"); } if(i==2) { printf("two"); } if(i==3) { printf("three"); } if(i==4) { printf("four"); } if(i==5) { printf("five"); } if(i==6) { printf("six"); } if(i==7) { printf("seven\n"); } if(i==8) { printf("eight\n"); } if(i==9) { printf("nine\n"); }
} else if(i > 9) { if(i%2 == 0) { printf("even\n"); } else { printf("odd\n"); } } else { printf("Invalid Operation\n"); } }
}
int main() { int a, b,n=6; scanf("%d\n%d", &a, &b); string(a,b,n);
return 0;
Seems like cookies are disabled on this browser, please enable them to open this website
For Loop in C
You are viewing a single comment's thread. Return to all comments →
include
include
include
include
void string(int a , int b, int n) { int i; for(i=a;i<=b;i++) { if(i>=1 && i<=9) { if(i==1) { printf("one"); } if(i==2) { printf("two"); } if(i==3) { printf("three"); } if(i==4) { printf("four"); } if(i==5) { printf("five"); } if(i==6) { printf("six"); } if(i==7) { printf("seven\n"); } if(i==8) { printf("eight\n"); } if(i==9) { printf("nine\n"); }
}
int main() { int a, b,n=6; scanf("%d\n%d", &a, &b); string(a,b,n);
}