Answer:
import java.util.Scanner;
public class test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int arr[] = new int[5], sum = 0;
for (int i = 1; i <= 5; i++) {
System.out.println("Enter subject " + i + " marks");
arr[i - 1] = sc.nextInt();
}
sc.close();
for (int i = 0; i < arr.length; i++) {
sum = sum + arr[i];
}
double percentage = (sum/500.0) * 100.0;
System.out.println();
if (percentage > 100) {
System.out.println("Wrong marks added");
} else if (percentage >= 90) {
System.out.println("You got A grade");
} else if (percentage >= 75) {
System.out.println("You got B grade");
} else if (percentage >= 50) {
System.out.println("You got C grade");
} else if (percentage >= 33) {
System.out.println("You got D grade");
} else {
System.out.println("Sorry you failed");
}
System.out.println("The percentage you got is " + percentage + "%");
}
}
Explanation:
Plz mark it as the brainliest