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

Acellus Business Math Question! ​
What is −314×435 ? Write the answer as a mixed number in simplest form.
Please HELP! Select a figure from the options which continues the same series as shown by the problem figures. I need answer please.
Do iron nails rust more in salt water than in vinegar? Please answer ASAP.
5x-4y=17 2x-3y=11 Solve with elimination method
Write a memo to inform the authority about the problems faced by computer centre regarding the installation of new equipment in the centre
How can two people have completely different personalities from each other? Support your argument with logical examples from your knowledge of Allport’s’ Trait
What determines the stability of nucleus. explain?
A TV satellite dish has a parabolic shape. Signals reflect off the dish and are collected at the focal point (focus) of the parabola. The distance from the vert
Found the following number to 1 significant figures: 238.02