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

Planets in our solar system orbit the Sun in perfect circles.
help pls i need help now​
Can anyone help me? I'm trying to write a poem for my grandparents anniversary, but I just can't find the words. If anyone is good at writing poems, can you hel
Question 4 of 5 In chapter 25, why can't the farmers pay workers to pick the fruit? A. Because there is so little fruit B. Because wages are too high C. Because
A trapezoid has bases that measure 10 cm and 6 cm. The height of the figure is 15 cm. What is the area of th trapezoid? 60 cm? O 90 cm? 120 cm? 150 cm?
Mr. Drake has an irrational fear of scantrons. What kind of disorder is this?
Which sentence from the selection from A Long Way Home is the best example of the author’s use of descriptive details about his emotions? A. I watched as the t
_________ maison est jolie, mais ____________ l’est encore plus. Pls tell me the awnser and the why.
The choices are agree or disagree
pls answer thank youuuu​