labs / tiddlers / content / review / java_exercises /
@Mark George Mark George on 15 Jul 2021 278 bytes Add review exercises

Write a Java console program that sums all of the numbers from 1 to 100 (inclusive), and prints the result to the console.

First use a for loop. Repeat the sum using a while loop, and again using a do-while loop.

FYI: the sum of all numbers from 1 to 100 is 5050.