You are viewing a single comment's thread. Return to all comments →
C
int main() { int a, b; char *words[] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; //printf("Please input interval [a,b]:\n"); scanf("%d\n%d", &a, &b); // Complete the code. //printf("Please input integer N: \n"); //scanf("%d", &n); for(int i = a; i <= b; i++){ if(i > 9){ if(i%2 == 0) printf("even\n"); else printf("odd\n"); } else if(i >= 1 && i < 9){ int mod = i%9; printf("%s\n", words[mod-1]); } else printf("nine\n"); } return 0; }
For Loop in C
You are viewing a single comment's thread. Return to all comments →
C