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

Need some help on this.....
Why is the heart/lung machine necessary when performing heart transplant surgery?
You have type b positive blood. what are all the types of packed rbcs you can receive?
explain why ecosystem require a continuous input of energy from the Sun
5.1 Describe unsafe practices that may effect the well being of individuals
After the revolutionary war which branch of government and the states Make more powerful
This US region is currently experiencing population growth. It is a major agricultural region for growing citrus, tobacco, and cotton. It is becoming increasing
A urinalysis has been ordered for a client. when is the best time for the client to provide a urine sample?
Why did the united states come to the aid of south korea when north korea attacked them and crossed the 38th parallel?
what is the English document that listed rights of citizens