Question: Write a for loop that reads an integer from the user, and prints the sum of numbers from 1 to that integer (inclusive). If the
Write a for loop that reads an integer from the user, and prints the sum of numbers from 1 to that integer (inclusive). If the user enters a number less than 1, he/she should be prompted to enter a number greater or equal to 1. In java
Sample input:
Enter an integer greater or equal to 1: 0
Wrong input!
Enter an integer greater or equal to 1: 2
Sample output:
The sum of integers from 1 to 2 is 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
