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

how do I work out this question? A train travels from London to Manchester it leaves at 16 55 and it arrives at 19 45. Work out the number of minutes the train
find the balance on a deposit of $1,150 that earns 9% interest compounded annually for 2 years
who was the roman governor that ordered jesus’s trial and execution?
What is the most crippling form of arthritis called?
Factor 30y 2 z 12yz 2 - 18yz.
if y=3x 2 find the value of y when x=-3
All of the following are immune disorders except: a. arthritis b. asthma c. hemophilia d. multiple sclerosis
which document, signed by king john in 1215, was important for the united states government? a. the preamble b. the constitution c. the magna carta d. the bill
Tú ________________ alto. a. es c. soy b. eres d. estás
Obesity is defined as being thirty percent over the recommended weight. true false