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

If you can help, u r much appreciated : )))
Click to review the online content. Then answer the question(s) below, using complete sentences. Scroll down to view additional questions. Online Content: Site
Find x Can someone help me plz!!!!
The chemical formula for water (2 hydrogen + 1 oxygen) shows how many __ of each element are in the compound. A neutrons B atoms C protons D electrons
Diana buys 5 sodas every week. Which of the following expressions shows the total number of sodas she buys in y weeks? (4 points) a 5y b Fraction y over 5 c
Please Help with this question!!
evaluate the expression when X= -2 x^2 + 9x + 3
Assessing Financial Statement Effects of Passive and Equity Method Investments On January 1, Ball Corporation purchased shares of Leftwich Company common stock.
The ______ is/are used to make small changes or additions to an original quote. 1. parantheses 2. ellipsis 3. brackets
Explain how the food groups overlap with a food like pinto beans.