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

what is the domain of the function f(x)=−2x(x−1)(x−2)?​
What is one way that economic institutions sustain themselves over time? A. by responding to changes in demand B. by continuing production despite demand
what’s 4.50 converted into scientific notation?
i need help on some math questions 1.the products of seven and the total or r and eight 2.three-sevenths of a number 3.the products of a number and ten more th
Which two sentences in the excerpt from Common Sense by Thomas Paine Indicate that Great Britain protected the American colonies for mutual gain? But she [Brita
The ancient city of Pompeii is not far from a large modern city. What is it called?
Which of the following statements best describes why burning a match would be considered a chemical reaction? a The match gets consumed by the fire. b Burning a
Please answer it ASAP!!!!!!!!​
When was ptolemy born the astronomer
8y+6x=7 solve for y PLEASE HELP ME WITH THIS IT'S FOR A TEST AND I DON'T GET HOW TO SOLVE IT!!!!