Write a java program to calculate the sum using while loop


Problem:

Question- Use while loop to write a Java program to calculate the sum of all numbers from 1 to a given positive number inclusive. Name the class as Sum, declare a field as sum, initialize sum in the constructor, and name the method as sumOfNumbers. Display the result as string.

Show the code, demonstrate it works properly and describe what it is doing.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a java program to calculate the sum using while loop
Reference No:- TGS0892949

Expected delivery within 24 Hours