UK: +44 748 007-0908, USA: +1 917 810-5386 [email protected]

Program that asks the user for a positive nonzero integer value

Write a program that asks the user for a positive nonzero integer value. The program should use a loop (while loop) to get the sum of all the integers from 1 up to the number entered. For examples, if the user enters 50, the loop will find the sum of 1,2,3,4,….50.

Hint: You need two while loops here. One to make sure the user enters a positive number (keeps on asking the user for a number till heshe enters a positive nonzero number). And two to find the sum.

Ready to Score Higher Grades?