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

When Queen Elizabeth I says that she has “the heart and stomach of a king,” she means that —?
What is potential energy?
Voting is both a right and a responsibility. a. True b. False
What class does the penguin belong to
Who declared that organized resistance by Southern states would prevent racial integration in the South?
The legs of a right triangle measure 9 inches and 12 inches. What is the length of the hypotenuse of this triangle?
Most herders in Central Asia today live as _______, moving their herds from mountain pastures in the summer to lowland pastures for the winter. a. PashtosB.
The pressure the gas exert the walls of the container will decrease because the gas particles hit the wall of the container
Line k has a slope of 2/3. If line m is parallel to line k, then it has a slope of -2/3 -3/2 2/3
Find the product. y^4 · y^6