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

the revenue from selling x shirts is r(x)=12. the cost of buying x shirts is c(x)=5x+20. the profit from selling x shirts is p(x)=r(x) - c(x). what is p(x)?
Could someone please help me with question 24
1981 novel that introduced hannibal lecter
A car engine changes chemical potential energy into the blank energy of the moving car?
Photo attached! 10 points!
The following figure is a trapezoid. The top base is 18 inches, and the bottom base is 22 inches. The height of the trapezoid is 8.5 inches. Find the area of th
in spanish where does the indirect pronouns go ​
Un hipopótamo pesa 1.5 montones.Cuanto pesa en onzas
16. The sides of a triangle are 10 cm, 8cm, and 10 cm. Classify the triangle.
please help me In what part of China did the population decrease the most? in the northeast in the northwest in the southeast in the southwest