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

me importa el medio ambiente y __________ a reciclar la basura. mi compañero de cuarto, fernando, tiene un perro entonces él va a __________al perro y _________
The heart, liver, and stomach are each examples of a. an organ system. b. a tissue. c. an organ. d. a nerve.
given the parent functions f(x) = 3x 2 and g(x) = 5x − 10, what is g(x) − f(x)? (2 points)
the primary language spoken in brazil is spanish
the first man made satellite to be placed into orbit
A series circuit contains two devices, one with a resistance of 10 ohms and one with a resistance of 4 ohms. If the generator supplies a voltage of 42 V, what i
simplify 15(1 1/5) and 24(1/3+1/8)
Who was the 21st president of the united states?
Bolívar had hoped for a unified state in latin america, but
a mole of carbon dioxide (co2) has 12.0 grams of carbon (c) and 32.0 grams of oxygen (o). what is the percent composition of carbon in carbon dioxide?