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

25-3x-2-4x+5 has how many coefficients and how many expressions
What is an oxymoron? Group of answer choices A moron who still uses oxy for their pimples. a state of affairs or an event that seems deliberately contrary to w
what is resulting fraction represented in figure?​
1 year and 240 days into ratio and reduced into the simplest form​
help mea) how far has the car travelled at the end of 5sec ?b) what is the speed of the car during the first 5sec?c) what has happened to the car after A? ​
At a speed of 60km/hr, a speedboat took 10 minutes to travel from one island to another. How far apart are the islands?​
Correlative conjunctions are used in pairs. TrueFalse
Help me !!Emergency..Fast​No spammers
is potential energy and kinetic energy real or is it theoretical and is used to explain how thing work? if it is real than where is potential energy stored? Bec
what is x = ? what is AB = ? what is BC = ?