+ 1

How can write Java Average and Above Average

Write a java program that reads ten numbers, computes their average, and finds out how many numbers are above the average.

5th Feb 2021, 3:53 PM
تركي الشهري
تركي الشهري - avatar
9 Réponses
+ 1
https://code.sololearn.com/cqSifWp47kKI/?ref=app Refer this code in case of any doubts feel free to ask
5th Feb 2021, 4:56 PM
Atul [Inactive]
+ 1
Import java.util.Scanner; class Learn{ public static void main(String []args){ Scanner scan = new Scanner(System.in); int[] a = new int[10]; for(int i =0; i<a.length; i++){ a[i] = scan.nextInt(); } int sum =0; for(i=0; i<a.length; i++){ sum += a[i]; } double ave = sum/a.length ; int count = 0; for(int i =0; i<a.length; i++){ if(a[i] > ave){ count++; } } System.out.println("The avarage = " + ave); System.out.println(count + " numbers are greater than avarage."); } }
6th Feb 2021, 1:39 PM
Nirmana Dasunpriya
Nirmana Dasunpriya - avatar
0
Please show your attempt
5th Feb 2021, 3:53 PM
Atul [Inactive]
0
how?
5th Feb 2021, 3:55 PM
تركي الشهري
تركي الشهري - avatar
0
Sum of the observation/no. Of observations. This is the formula for calculating average. So accordingly try to solve it
5th Feb 2021, 4:05 PM
Atul [Inactive]
0
i dont know💔
5th Feb 2021, 4:07 PM
تركي الشهري
تركي الشهري - avatar
0
Thank you very much❤️❤️❤️❤️❤️❤️❤️❤️
5th Feb 2021, 4:59 PM
تركي الشهري
تركي الشهري - avatar
0
My pleasure
5th Feb 2021, 5:11 PM
Atul [Inactive]
0
Thank you very much🤍🤍🤍🤍🤍🤍🤍
6th Feb 2021, 5:08 PM
تركي الشهري
تركي الشهري - avatar