int sum = 23; for(int i = 2; i <= 5; i++ ) { for(int j = 7; j <= 9; j++ ) { sum += ( i * j); } } System.out.println("sum = " + sum); }
explanation
Answers
Answered by
3
Answer:
First, you defined a variable called 'sum', and its value is 23
Then, you have 2 nested loops ranging from 2-5 (i) and 7-9 (j), both incrementing by 1 each time it loops through one time. In the inner loop, you change the 'sum' value to i (which ranges from 2-5) times j (which ranges from 7-9), then printing it out after it loops through the second nested loop.
Explanation:
Hope this helps!
Similar questions
Accountancy,
3 hours ago
Math,
3 hours ago
World Languages,
3 hours ago
Chemistry,
6 hours ago
History,
8 months ago
Physics,
8 months ago