public static void main(String[] args) {
int agrades = 0;
int fgrades=0;
int count=0;
Scanner input = new Scanner(System.in);
System.out.println("Enter Grades: ");
int grades = input.nextInt();
while (grades>=0 && grades<=0){
if (grades>=90 && grades<=100)
agrades++;
if (grades>=0 && grades<=60)
fgrades++;
count++;
grades = input.nextInt();
}
System.out.println("Amount of Grade: " + count);
System.out.println("Average Grade: " + (grades+grades/count));
System.out.println("Number of grades above 90: " + agrades);
System.out.println("Number of grades below 60: " + fgrades);
}
}
#Exception in thread "main" java.lang.ArithmeticException: / by zero
at javaapplication12.JavaApplication12.mainsnippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 3 seconds)
Andrew_70 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.