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

Write the name of a shape that has no sides and no vertices
A plane flies round-trip to Philadelphia. If flies to Philadelphia at 220 miles per hour and back home with a tailwind at 280 miles per hour. If the total trip
A spinner is divided into 16 sections.3 sections are red 6 are blue 5 are purple and 2 are orange. If you spin the spinner what is the probability that you will
What is an adjective phrase?
What features of colonial politics in 18th century America contributed to the development of popular democracy, and what kept political life from being more tru
Estimate 46/6,725, then find the quotient.
David bought a game on sale for $6 less than half its original price.she paid $88 for the jacket. What was the original price
WRITE EACH RATE AS UNIT RATE. 162 WATER BOTTLE IN 9 CASES=
How did geography influence the way the Incas ruled the empire?
Solve the equation for y.4x – 5y = 9