Answer to Question #309934 in Java | JSP | JSF for Dee

Question #309934

Write a program to receive ten floating points value,store them in an array. Then calculate and display their average.

1
Expert's answer
2022-03-11T09:53:19-0500


import java.util.*;


class App {


	public static void main(String[] args) {
		Scanner keyboard = new Scanner(System.in);
		double[] numbers = new double[10];
		for (int i = 0; i < 10; i++) {
			System.out.print("Enter number: ");
			numbers[i] = keyboard.nextDouble();
		}
		double sum = 0;
		for (int i = 0; i < 10; i++) {
			sum += numbers[i];
		}
		double average = sum / 10.0;
		System.out.println("Average: " + average);


		keyboard.close();
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS