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

Vector g is shown below. Vector h is parallel to g, in the same direction and half as long. Work out h as a column vector. 9
The physical world around us behaves as it does partly because it’s made of a huge number of tiny molecules, each behaving randomly. In the 1800s, the Scottish
Write a quadratic function f whose zeros are 2 and 7.
2. If a student drops a 2.3 g piece of magnesium into a flask of hydrochloric acid, this reaction occurs: Mg + 2HCl MgCl2 + H2 How many liters of hydrogen can b
state two factors that affect current carrying capacity of an accumulator
Given circle with radius of 5cm. Find out (a) diameter (b) perimeter (c) area
1) Suppose the heights of 18-year-old men are approximately normally distributed, with mean 71 inches and standard deviation 5 inches. a) What is the probabili
How are mitosis and meiosis similar?
A man on a bicycle of total mass of 10kg has a Velocity of 2 ms.' He Paddles faster for 5 seconds and the velocity Increase to it 4ms Calculate the average forc
answer it pls... T_T .​