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

If 3x – 10 = 17, what is the value of 6x + 20 ?
Which sign is the less sign and which one is the greater sign (can someone please tell me I really need help! and I never understand the signs!) is this greater
why did the framers give the power to congress rather than to the states?
Two parents with dimples have a child with no dimples. The allele D for dimples is dominant. What are the possible genotypes of the parents? I. DD and Dd II. Dd
You sell pies at a farmers' market for $7.50 each. A group of 5 kids wants to pitch in equal1y to share one of your pies. How much will each of them need to pa
Write good insulators around the home
The weekly sales of a magazine increased from 500,000 to 600,000. By what percentage did the magazine sales increase?
Which decimal is equivalent to 13/20?
If 3x – 10 = 17, what is the value of 6x + 20 ?
how far away is all 9 planets from the sun