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.