We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C
- Conditionals and Loops
- For Loop in C
- Discussions
For Loop in C
For Loop in C
Sort by
recency
|
847 Discussions
|
Please Login in order to post a comment
gfvdddddddddrrrrrrrrrr
It's great for beginners to grasp the fundamental concept, and this description helps demystify the structure and flow of the for loop in programming. Well done! ekbet 40
int main() { int a, b; scanf("%d\n%d", &a, &b);
}
char *numbers[] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; for (int i = a; i <= b; i++) { if (i <= 9) printf("%s\n", numbers[i-1]);
else if (i > 9) { char *even_or_odd = (i % 2 == 0) ? "even" : "odd"; printf("%s\n", even_or_odd);
} }