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

Why were the 1920's considered the best and worst of times?
Fragment in this sentenceWith her heavy dictonary, Donna thumps the top other ancient computer monitor.  Whenever the color tint flickers from normal to sickly
Luke made a model that has 1 circular base and 1 curved surface.what solid figure did he make
How did the Declaration of Independence change the nature of the American Revolution?
What's a good slogan for a dietitian (have dietitian in it) ?
What is a group of organisms that look alike and can reproduce among their selfs ?
How did the Declaration of Independence change the nature of the American Revolution?
Luke made a model that has 1 circular base and 1 curved surface.what solid figure did he make
Rico is making4 batches of mexican rice. each batch needs 2/3cup of corn. He only has a1/3-cup measure.How manytimes must Rico measure 1/3cup of corn to have en
What is a series of events that cells go through as they grow and divide