Fill This Form To Receive Instant Help
Homework answers / question archive / Write below Java application which prompts the user to enter 15 integers, then computes the sum, and then prints the sum to the screen
Write below Java application which prompts the user to enter 15 integers, then computes the sum, and then prints the sum to the screen.
import java.util.Scanner;
public class SumInts
{
public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
int sum=0;
System.out.print("Enter 15 integers: ");
for (int i=1; i<=15; i++) sum += scan.nextInt();
System.out.println("The sum is " + sum);