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 is 9.35 as a fraction
write in exponent form and word form 10x10x10
What is 21 over 40 in percent
Which expression could be a calculator’s display for the number 135,000,000,000,000? A. 0.135e15 B. 1.35e14 C. 13.5e13 D. 134e−14
What are some of the changes in the way people live in the United States now compared to a hundred years ago
What is a positive connotation for odd?
New London, Connecticut, is the location of the A. National Oceanic and Atmospheric Administration. B. Air Force Academy. C. Naval Command Center. D. Coast Guar
What's 30.08 divided by 4
How did the American preacher Jonathan Edwards’s preaching style compare with the British preacher George Whitefield’s?
All of the following developments helped make the cattle business profitable except: A. barbed-wire fences B. new railroads and refrigerated cars. C. growing