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

Evaluate the following expression for x=3 the expression is 2(x-1)
Use the distributive property to remove the parentheses. -8(-v(3)-3+6x(3)) The 3 in their own parenthesis are the power of 3
No is divisible by 7 if n is divided by 2 3 4 5 the remainder is 1 what is the smallest value that n could b
Which of the following is equal to 5.3? A. 4.6 + 2 × 5 – 2 ÷ 2 B. 4.6 + 2 × (5 – 2) ÷ 2 C. [4.6 + 2 × (5 – 2)] ÷ 2 D. (4.6 + 2) × 5 – 2 ÷ 2
Mike just looked at his spending from last month and discovered he spent $120 buying movies. Mike knows that $120 is a lot of money to spend on movies and decid
find x in the equation x² - 7 = 4x + 5
How do you this question? Please explain.
Can you use the word 'dint' in a sentence? One of the definitions is "force, power"
Which statement about William Lloyd Garrison's newspaper the Liberator is true? A) It was only published for a very short time. B) It stopped publishing when t
Complete the sentence La mesa __________ en la sala. A. está B. estamos C. están