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 who u solve 5+2(x-3)
Which of the following scenarios exhibits a function relation? Take the first set listed to be the domain of the relation. the set of tree heights and the set o
how can i use point mutation in a sentence
y-3=3(x+1) What is the equation in standard form of a parallel line that passes through (0, -3)
Hydrogen gas is a(n): atom of hydrogen, molecule of hydrogen, OR different element from hydrogen?
Why is it a better to wear a white shirt on a hot summer day instead of a black shirt?
Is Mirna a Latin name
Light can be transmitted through long fiber optic strands because of a. refraction. b. external diffraction. c. total internal reflection. d. interference
what does brink of extinction mean
Kristy ran 700 meters, while Jessica ran 4 kilometers. Who ran the furthest?Explain.