Write a program named: SumRange.java This program will prompt the user for two integer values, a min and a max. Then, calculate the sum of all integers from min to max, including both. Do NOT assume that the first value entered will be smaller than the second. Make sure you check which is the smallest and largest. Then print the result to the screen. sample: Enter two integers,
Write a program named: SumRange.java
This program will prompt the user for two integer values, a min and a max. Then, calculate the sum of all integers from min to max, including both. Do NOT assume that the first value entered will be smaller than the second. Make sure you check which is the smallest and largest.
Then print the result to the screen.
sample:
Enter two integers, and I'll tell you the sum of all integers between the two (including both): 5 12
The sum is: 68
Enter two integers, and I'll tell you the sum of all integers between the two (including both): 10 2
The sum is: 54
Enter two integers, and I'll tell you the sum of all integers between the two (including both): -5 -10
The sum is: -45
Enter two integers, and I'll tell you the sum of all integers between the two (including both): -5 5
The sum is: 0
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images