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

This is a policy by the Federal Reserve to reduce the money supply and slow down economicactivity, mainly by raising interest rates, selling securities, and/or
Compose and deliver at least 3 of your own sentences in varying volumes. Notate the sentence and dynamic level you speak it at. How does this change the message
Solve for X. (Help me please)
Answer please. If you are right I will give 20 points and mark brainiest Plz
A connection between different churches across europe
What details could you include in your discussion of immigrants’ experiences during the journey to America? Check all that apply. Steamships were much larger th
where did the empryo gets its energy or food to grow?​
Definition of go to the ends of the earth
Desmond has $90,000 in a savings account. The interest rate is 8 % per year and is not compounded. How much will he have in 3 years?
Which statements accurately describe Earth’s magnetic field? Check all that apply. The magnetic field lines flow from Earth’s geographic South Pole to Earth’s