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

In this excerpt from act V of Shakespeare's Romeo and Juliet, Friar Laurence's letter to Romeo is not delivered due to circumstances beyond his control. What is
What do we call 2or more substances bonded together that have properties different from the elements that make them up
i tried to do these they just aren't cliqueing with me :/
according to Rhodes, why should britain pursue a policy of imperialism ?
Which system can be used to represent, x the number of tetra fish, and y, the number of goldfish, he purchased?
when does the velocity and speed of a moving body becomes identical?
Which belief system emerged as a philosophy of social conduct rather than as a belief in one or more deities? A.Jainism B.Confucianism C.Hinduism
13°38'35" to decimal degrees
How are vivid nouns different from non-vivid nouns?
which transport process always involves the movement of materials from inside the cell to the outside the cell