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

uh just take em ok ‼️‼️‼️‼️‼️
If 40% of x = Rs 200​
2. What do fung grow from? A seeds B. flowers C spores & most D. fruit​
Why did Lavinia’s face look white and pinched
Classify the equation as a conditional equation., an jdentity, or a contradiction and then state the solution. 8(1-3x)+15(2x+7)=2(x+50)+4(x+3)+1
Sa mga lugar na Kung saan ang isang salita o grupo ng mga salita ay maaaring isalin sa iba pang paraan, ito ay binibigyang pansin sa talababa (footnote) sa pama
Determine the sum of the first n terms of the sequence a, a + d, a + 2d, a + 3d, ... where n represents a natural/counting number, and a and d represent any rea
please help! You are going to study the diversity of the island lizard population that was relocated to the mainland. What would be the best approach to the st
How should this situation have been prevented
Área de este poligano por favor