Discover a world of knowledge at Westonci.ca, where experts and enthusiasts come together to answer your questions. Experience the ease of finding reliable answers to your questions from a vast community of knowledgeable experts. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently.


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.

Sagot :

nunoz

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)”
}
}