CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Counting Multiples in a Loop

Java code walkthrough · Question 14
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