Skip to content

Instantly share code, notes, and snippets.

@rapisenpai
Last active December 28, 2021 06:44
Show Gist options
  • Save rapisenpai/4bd035eef5df18ff53f11734b0f08fc6 to your computer and use it in GitHub Desktop.
Save rapisenpai/4bd035eef5df18ff53f11734b0f08fc6 to your computer and use it in GitHub Desktop.
package homwad.rafhaellowix.dnsc.edu.ph;
import java.util.Scanner;
public class ArrayExercise1 {
public static void main(String[] args) {
double sum = 0;
Scanner sc = new Scanner(System.in);
int grades[] = new int[20];
int max = grades[0];
int min = grades[0];
System.out.print("Enter final grade for student no. 1: ");
int student1 = Integer.parseInt(sc.nextLine());
grades[0] = student1;
int passing = 0;
for (int i = 0; i < grades.length; i++) {
if (grades[i] > max) {
max = grades[i];
}
if(grades[i] <min)
min = grades[i];
//Print
System.out.println(grades[i]);
if (grades[i] <= 76 || grades[i] <= 80) {
passing++;
}
}
System.out.print("\nHighest Grade: " + max);
System.out.print("\nLowest Grade: " + min);
System.out.println("\nGrade 76-80: " + passing + " Student/s" );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment