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 did northern and southern views of slavery differ?
Together all of an individuals genes are called his or her? A genome B chromosome C nucleotides D species
Which set of adjective pairs correctly describes the clusters into which dsm-5 personality disorders are grouped?
3x + 159 = negative-2x + 4.
Read the sentences below: There are many threats to dolphins' continued existence. Humans are just one. Choose the correct version of the combined sentence.
Why does a calculator return an error when trying to find inverse sine of 1.055?
Representational art with an approach to naturalism covers:
Simplify: 23b4+(-10b4)
Can somebody help me solve this, please?
Resistant and Yielding A. Synonyms B. Antonyms C. Neither