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

Summing Even Numbers with Modulo

easyLoops

📄 Code

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

🎯 Your Answer