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

Use the Distributive Property to simplify 5/6(x + 1/2 + 4)
What is the mass of an object that has a density of 1.42 g/mL and a volume of 12.1 mL?
Are the graphs of y=3x-5 and 9x+3y=1 parallel, perpendicular or neither?
atom can The ground state electronic configuration of be represented by
Find the slope of the line passing through the points (5, 1) and (5, "-6)"
PLEASE HELP!! NO LINKS PLS If given the following situation; At a fair, each person can spin two wheels of chance. The first wheel has the numbers 1, 2, and 3.
Help me please Only no.2 no.3 no.8 no.6 no.9 and no.10
Cuenta brevemente un momento en el que las palabras se te hayan escapado
Can 1 be expressed as a fraction
how do I write and answer 14h35 in french time?​