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 is greater 0.37 or 1/3
Which two events were the foundations of the women's suffrage movement in the united states?
Please need help. Thank you
Which of the following sentences are punctuated correctly? A: I want it right now! "she demanded angrily." B: "I want it right now! she demanded angrily." C: "I
Where does the breakdown of glucose into puruvate occur
How did western expansion become inextricably linked with sectional identity during the 1840s?
Which country borders Venezuela to the south?
A object weighing 5 kg, starts to accelerate evenly on a horizontal line. A force moves the object12 meters in 2 seconds. Find A (work)=? Of that force.
Monique ran one mile in 6 minutes. Her average speed was how many miles per hour?
As the volume of financing increases, the costs of the various types of financing will ________, ________ the firm's weighted average cost of capital. a. increa