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 whole number that is equal to 6/2
What's 20 over 100 as a percent?
a mixture of pepper and water is a suspension because
using the system of substitution 2x-3y=12 x + y=9
From a deck of 52 cards, two cards are radomly drawn without replacement. Which expression represents the probability of drawing two hearts? A. 2/52 B. 13/52· 1
TO KILL A MOCKING BIRD Why would Jem not be a good replacement narrator for Scout? A. Jem can relate events from an omniscient point of view. B. Jem grows up
Why is understanding how much Travis loves Old Yeller important? A. It allows the reader to see how lonely Travis is after his father leaves. B. It demonstrates
how many acres of land are in a rectanglar parcel 234' * 878'
How is it that a square is a rectangle but a rectangle ins't a square?
turn 32/64 into a percent?