You are viewing a single comment's thread. Return to all comments →
void check_digit(int x) { if ((x >= 1) && (x <= 9)) { if (x == 1) { puts("one"); } else if (x == 2) { puts("two"); } else if (x == 3) { puts("three"); } else if (x == 4) { puts("four"); } else if (x == 5) { puts("five"); } else if (x == 6) { puts("six"); } else if (x == 7) { puts("seven"); } else if (x == 8) { puts("eight"); } else if (x == 9) { puts("nine"); } } if (x > 9) { if ((x % 2) == 0) { puts("even"); } else { puts("odd"); } } }
int main() { int a, b; scanf("%d\n%d", &a, &b);
for (int i = a; i <= b; i++) { check_digit(i); } 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 →
void check_digit(int x) { if ((x >= 1) && (x <= 9)) { if (x == 1) { puts("one"); } else if (x == 2) { puts("two"); } else if (x == 3) { puts("three"); } else if (x == 4) { puts("four"); } else if (x == 5) { puts("five"); } else if (x == 6) { puts("six"); } else if (x == 7) { puts("seven"); } else if (x == 8) { puts("eight"); } else if (x == 9) { puts("nine"); } } if (x > 9) {
if ((x % 2) == 0) { puts("even"); } else { puts("odd"); } } }
int main() { int a, b; scanf("%d\n%d", &a, &b);
}