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

Poverty Point is located on Macon Ridge, overlooking the west side of the Mississippi River floodplain. Before the current man-made levee system, the Mississipp
Graph the solution to the inequality |y+5|> 2
What is the main part of a note? a)stem b)head c)flag
Can a country be free from the rule of another government but still accept financial help
can you please help me ​
What type of source is this
− 4 y − 3 + 3 y = 8 − 2 y − 15
1. A taxi cab costs $4.50 for the first mile and $0.75 for each additional mile. Write & solve an equation that could be solved to find how many miles you c
Write the number equal to 2 tens 15 ones.
Someone help me with this, The form for this problem says I’m wrong about the Domain {(-3,-2),(-1,0),(0,1),(3,4,),(6,7)} Domain: {(-3,-1,0,3,6,)} I’m sure I’m c