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

What group of people served in the Tribal Assembly? A. women B. slaves C. plebeians D. patrician
6 divided by 3.6 equals what tenth place
the width of a singles tennis court is 75% of the width of a doubles Court a doubles court is 36 feet wide how wide is a singles Court
What does making a credit card minimum payment mean?
When adding 51.2 to a certain number, the sum is 56.05, as seen below. What number should go in the box to complete the addition problem?
Read this sentence. After months of cold weather, most of the community spent the warm weekend outside. Which answer adds a participial phrase to the sentence?
About 43% of blood consists of red blood cells. True False
Which of the following is an example of the power of the press? the increase in digital technology the creation of the printing press the United States’ involve
The state tax on clothing is 5.50 percent. what is the cost of 25$ shirt, including tax?
Heterogeneous mixture is one that is not Uniform throughout Easily mixed together Made of two or more liquids Edible by humans