answersLogoWhite

0


Best Answer

import java.util.Scanner;

public class Numbers

{

public static void main(String[] args)

{

Scanner scan = new Scanner(System.in);

int max = -100;

int min = 100;

int sum = 0;

System.out.println("Enter ten integers");

for(int i = 0; i < 10; i++)

{

int input = scan.nextInt();

if(input > max)//test if the number entered is larger than any previous number

max = input;

if(input < min)//test if the number entered is smaller than any previous number

min = input;

sum += input;//add the input to the sum

}

System.out.println("The maximum number entered is: " + max +

"\nThe minimum number entered is: " + min +

"\nThe average of the numbers is: " + (sum / 10));//prints out the results

}

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you Write a java program to find the average of given numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Shell program for gcd of three given numbers?

write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


How do you write a program that removes all occurrences of a given X in a given sequence of numbers?

You do nothing! A sequence of numbers will contain no X and so nothing needs doing!


How do you write a c program sum of ODD Numbers in the Given Range?

Reference: cprogramming-bd.com/c_page4.aspx#ODD%20 Numbers


How can you write a program to find the mean resistance in c language given the values of 8 resistances?

"Mean" usually means "average", so you just add the numbers together, then divide by 8.


How do you write a program that calculates the sum of the matrix elements given numbers?

ring me and ill explain - 086 22222222222222227 ring me


Write a java program to find sum of even and odd numbers in given array?

for(int i = 1; i &lt; 100; i+=2) { System.out.println(i); }


Write a C program to extract a given word from a file?

program to extract a given word from a file


How do you write a program to find out the percentage of given numbers using the structure in C?

Count all the given numbers then count all the numbers of a given value. Divide one by the other and multiply by 100. For instance, if there are 50 numbers in total and 5 of them have the value 42, then the percentage of numbers with the value 42 is 5 / 50 * 100 = 10%.


How can you write a program specification for a given report?

It is your face


How do you find the missing number in a set of numbers where the average is given?

The average of a set of numbers is defined as the sum of those numbers divided by the number of numbers. If the average is given, multiply that by number of items in the set including the missing number. Subtract the sum of given numbers from this quotient and the missing number is revealed.


How do you write a fraction or decimal that has a value between the given numbers?

Without knowing what the numbers are, I would suggest taking the mean of the given numbers.