CJCoding With Joseph
← Back to Question List
C Code Walkthrough #27

Counting Nested Loop Iterations

mediumLoops

📄 Code

Read carefully — what does this print?
1#include <stdio.h>
2int main() {
3 int count = 0;
4 for (int i = 0; i < 3; i++) {
5 for (int j = 0; j < 2; j++) {
6 count++;
7 }
8 }
9 printf("%d\n", count);
10 return 0;
11}

🎯 Your Answer