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

how do you figure out what is 1/4 of 10.
the rectangles on a quilt are 2in. wide and 3in. long the perimeter of each rectangle is made by pattern of ref thread. if there are 30 rectangles in the quilt,
How can i solve this f:d->R f(x)=x at power2/x-1
A boy can swim 75 feet in 12 seconds. What is his rate to the nearest mile per hour?
Estimate the angle of elevation from the trailhead to the summit.
How do you say little sister, little brother, older sister, and older brother in Korean? I hope someone who actually know Korean can answer this question.
Most autotrophs make “food” through the process of a. photosynthesis. b. homeostasis c. chemosynthesis d. cellular respiration
An object of mass 2 kg has a linear momentum of magnitude 6 kg • m/s. What is this object’s kinetic energy?
How many prime numbers are there between 56 and 100?
given: quadrilateral ABCD with ∠A= ∠C and BD the bisector ∠ABC prove: DB bisects ∠ADC