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

Scientists and historians believe that the time from prehistory to the development of agriculture spans more than two million years. a. True b. False
five digt number divisible by 4 and 6
What is 0.5 in fraction?
connecting the past to the present helps you to know how people have ?
list 3 ways scientist can reduce bias
Which causes strep throat, anthrax, and tetanus?
how can a physical map help explain the historical development of a country
A rate simplified so that it has a denominator of 1?
This city was the scene of one of the most violent demonstrations in American history in 1999 when 100,000 people engaged in civil protest against the WTO? Seat
jack travles 2.45 miles to school.Wanda travels 2.31 miles to school.Compare the distance using words.