package javaapplication28; import java.util.*; public class JavaApplication28 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter scores: (negative number signifies end): "); double[] scores = new double[100]; double num; double average=0; double Scores=0; for (int i = 0; i < 100; i++) { num = input.nextDouble(); if (num > 0) { scores[i] = num; average += num; Scores++; } else { break; } average /= Scores; int aboveOrEqual=0; int below=0; for (int j= 0; j< Scores; j++) { if (scores[i] >= average) aboveOrEqual++; else below++; } System.out.println("\nAverage of scores: " + average); System.out.println("Number of scores above or equal to average: " + aboveOrEqual); System.out.println("Number of scores below average: " + below); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)