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

Jane is 15 years older than Ganesh. She is four times as old as ganesh. Find their present ages
A cannon fires a projectile and it strikes the ground 3.0 km away. Assume the shot starts and lands at the same height. The maximum height the projectile reache
what is 4 kilograms kg in grams g
WILL GIVE BRAINLIEST IF ANSWERED QUICK!! I GIVE GOOD RATINGS FOR GOOD ANSWERS!
WILL GIVE BRAINLIEST IF ANSWERED FAST!!!
WILL GIVE BRAINLIEST IF FAST!! GIVE GOOD REVIEWS FOR CORRECT ANSWERS!
Joe has a weight of 1012 N (about 223 lb) when he is standing on the surface of the Earth. (a) What would his weight (the gravitational force due to the Earth)
WHAT MASS OF A 7.00% HNO3 SOLUTION BY MASS CONTAINS 74 g OF HNO3?
what is the lcf of 4 and 5
In a vegetarian diet, 46 individuals include fruits in their meals and 22 individuals eat without including any fruits. Express the following in ratios: Fruit c