import java.util.*; public class Sum // Change the name of class for your purpose { public static void main(String [] args) { // Input: a positve integer // Output: to compute the sum of integers 1, 2, ... N int count = 1; int sum = 0; Scanner con; con = new Scanner(System.in); System.out.println("The program computes the sum of 1, 2, ... N"); System.out.println("Enter the integer N:"); int N = con.nextInt(); while( count <= N) { // Loop body sum = sum+count; count++; } System.out.println("The sum of 1, 2, ... " + N + " is " + sum); } }