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 main function of a boat trailer's safety chains?
Which sentence is constructed correctly and clearly? Because we wanted at long last to be finished with the project, we forgot the conclusion. Because we wanted
The rhythm of the opening statement of Beethoven's Fifth Symphony is a. s-L-s-L. b. L-s-s-s. c. s-L-s-s. d. s-s-s-L.
Joan works for 6 hr each weekday and 8 hr total on the weekends . She earns $6 an hr on weekdays and $9 an hour on weekends. How much money does she earn each w
In a business letter written in full-block style, the dateline should be a. at the very top of the page. b. omitted. c. between the inside address and the su
What type of rock can melt under the right conditions?
What is the least common multiple of 16 and 24
What is the domain of the relation {(2, 8), (0, 8), (–1, 5), (–1, 3), (–2, 3)}?
Environmental pollution does not affect an individual’s health. True or false?
Nouns cannot be paired with verb phrases to create parallel structure. a. True b. False