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

Which sentence best defines parallel structure at the sentence level? Two or more phrases in a sentence are the same length. Two or more parts of a sentence are
Which of the following writing techniques can be used to help readers understand a story? Using transitions to connect events and experiences that the characte
Roman numerals in an outline signify main ideas. true or false
5. How can you use this document to argue that Alexander was not great?
Stiff muscles only result from overworking them
How did this corruption and fraud impact negatively in the country: for example service delivery,tax,expense of trial?
¿Cuales son las palabras que deben tener acento?
How did the Battle of Gettysburg affect European governments?
What is GOOD in Spanish?
一1423-16 田5 +5>X-161718sm co,