CJCoding With Joseph
15per day
← Back to Question List
Java Code Walkthrough #14

Counting Multiples in a Loop

easyLoops

📄 Code

Read carefully — what does this print?
1public class Main {
2 public static void main(String[] args) {
3 int count = 0;
4 for (int i = 1; i <= 10; i++) {
5 if (i % 3 == 0) {
6 count++;
7 }
8 }
9 System.out.println(count);
10 }
11}

🎯 Your Answer