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

PLZZZZZZZZZ HELP THERE IS JUST THIS ONE AND IM STILL CONFUSED PLZZZ HELPPPP ME REAL QUICK ITS REALLY EASY
Why were the missiles placed in Cuba? Why are they being removed?
What issue was at the root of the nullification crisis?
Compare the emergence of advanced civilizations in Meso and South America with the four early river valley civilizations. Which of the following fulfilled the
What is 5.95 × 106 written in standard form? A. 595,000 B. 59,500 C. 5950 D. 5,950,000
Which of these does not describe an ethical dilemma associated with the field of prosthetics?
What type of chemical reaction happens when one element replaces another element in a compound?
Reduce 30/36 to its most simple form
Julia spent $58 on a book. the cost of the book was $20 less than twice what she spent on a backpack. how much did the backpack cost?
I have post nasal drip, what drug can i take along with metoprolol for this sinus condition?