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

Graph the line using intercepts: 4x-3y=12
how is the expression of sex linked genes both  similar to and different from the expression of autosomal genes?
What's a good slogan for a dietitian (have dietitian in it) ?
What culture believes health is harmony between man and nature?
Which is the same as 0.08? A) 80% B) 80/100 C) 8% D) 0.8
True or False along a divergent boundary, two plates slip past each other,moving in opposite directions.
State two ways in which a single-celled organism, such as amoeba, and a human body are alike?
Why did president Washington want the United States to remain neutral
How do you work out the problem 84 divided by4
Luke made a model that has 1 circular base and 1 curved surface.what solid figure did he make