XYZ school has conducted the annual examination for the 5th standard class and they want to calculate the grade for the students who all attended in the annual examination. Each student has 5 subject marks. Let's help them to calculate the grade for the students. java

Answers 1

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

If you know the answer add it here!

Can't find the answer?

Log in with Google

or

Forgot your password?

I don't have an account, and I want to Register

Choose a language and a region
How much to ban the user?
1 hour 1 day 100 years