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 should you always remember when handling microscope slides?
What goes into the cell for cr to occur
What is the simple subject of a tornado shape is like a funnel?
can someone give me two equations an tell me which of the two would be steeper ?
If two objects at different temperatures are in contact with each other, what happens to their temperatures?
Which is an example of the bottleneck effect? Green beetles move to a new location and build a new colony there. Green beetles survive as birds don't see them
the diffrence between a glacier and a geyser
Value of 17 + 5b when b = 1
Evolution _____. A) happens very quickly B) happens on a genetic level C) happens whenever an organism changes D) is the same as growth and metamorphosis
Express the number 20000 as a single digit integer times a power of 10