Write a program that reads an unspecified number of scores and,

PHOTO EMBED

Thu Apr 22 2021 12:14:50 GMT+0000 (Coordinated Universal Time)

Saved by @ahmedqgqgq #java

import java.util.Scanner;

//Write a program that reads an unspecified number of scores and,
//determines how many scores are above or equal to the average and how many,
//scores are below the average. Enter a negative number to signify the end of the,
//input. Assume that the maximum number of scores is (10),
public class Ok {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter Scores:(negative number signifies end):");
        int scores[] = new int[10];
        int numberofScores = 0;
        int average = 0;
        for (int i = 0; i < 10; i++) {
            scores[i] = input.nextInt();
            if (scores[i] < 0)
                break;
            average += scores[i];
            numberofScores++;
        }
        average /= numberofScores;
        int AboveOREqual = 0, below = 0;
        for (int i = 0; i < numberofScores; i++) {
            if (scores[i] >= average) {
                AboveOREqual++;
            } else {
                below++;
            }
        }
        System.out.println("\n Average of scores:" + average);
        System.out.println("Number of scores above or equal to average:" + AboveOREqual);
        System.out.println("Number of scores below average:" + below);

    };
};
content_copyCOPY