Question: Using Java Sum of 50 numbers 4 .Write a program that asks user for a positive integer value. The program should use a loop to

Using Java
 Using Java Sum of 50 numbers 4 .Write a program that

Sum of 50 numbers 4 .Write a program that asks user for a positive integer value. The program should use a loop to get the sum of all integers from 1 up to the number For eg if the user enters 40, it should find the sum of 1 to 40 . Output Enter a positive nonzero number: 40 The sum of all the integers from 1 through 40 is 820 Validation should be done if it is a non negative numbetr Enter a positive nonzero number: -20 Invalid. Enter a positive nonzero number: 20 The sum of all the integers from 1 through 20 is 210

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!