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

Draw the lewis structure for c2h2 (whose skeletal structure is hcch). draw the molecule by placing atoms on the grid and connecting them with bonds. include all
piagets stages of cognitive development in order are
how can the rate of the reaction be increased?
Which statement best describes Rutherford's model of the atom?
was split in half by the Great Schism
The IRS says you are in a certain tax bracket if your taxable income, i, is over $24,500, but not over $59,725.
A direct variation function contains the points (2, 14) and (4, 28). Which equation represents the function?
slice of pie cut at 72 degree many left
What is the unit rate for 768.57 m 41.1 h? Enter your answer, as a decimal, in the box.
South Korea exports many of the parts that are on the cars we drive each day. Luckily, there are safety regulations in place to make sure these parts are safe f