omarion83 omarion83
  • 02-04-2022
  • Computers and Technology
contestada


Write a program that asks the user to type 5 integers
and writes the average of the 5 integers. This
program can use only 2 variables.

Respuesta :

nunoz
nunoz nunoz
  • 03-04-2022

import Java.util*

public class Average{
public static void main(String [] args){

int sum = 0;
int numbers = 0;

for(int i = 0; i < 5; i++){
Scanner sc = new Scanner(System.in);
System.out.println(“Please enter your integers: “);
numbers = sc.nextInt();

sum += numbers;
}
System.out.println(“The average is: “ + sum/5)”
}
}
Answer Link

Otras preguntas

other name for blood
Who were the Nazis ?
What is the lateral area of the rectangular prism with a base length of 17 m, a base width of 7 m, and a height of 5 m?
Two 1 litre jugs are each filled with a mixture of olive oil and vinegar. The first jug has 3 times as much as oil as vinegar and the second jug has 4 times as
If 2 less than or equal too X less than or equal too 6, which of the following has the greatest value
solve 2/3 + 1/4x = 1/3
Horace read 160 pages in 4 hours. How many pages can he read in 6 hours??
What is the lateral area of the rectangular prism with a base length of 17 m, a base width of 7 m, and a height of 5 m?
What is the coefficient of y in the expression 12+3y-2x?
The plans for a shed call for a rectangular floor with a perimeter of 204 ft. The length is two times the width. Find the length and width.