Write a Java program to accept marks of one student in three subjects, find the total mark and print his / h * e * r grade by following the given condition. If total mark >=125,grade=PAS otherwise grade = FAlL .
Answers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Java program to accept the marks of a student in three subjects and find the total marks and print the grade according to the condition is given below;
import java.util.*;
class student
{
public static void main() //Main function
{
int marks_1,marks_2,marks_3,total_marks;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the marks in the first subject");
marks_1 = sc.nextInt();
System.out.println("Enter the marks in the second subject");
marks_2 = sc.nextInt();
System.out.println("Enter the marks in the third subject");
marks_3 = sc.nextInt();
total_marks = (marks_1+marks_2+marks_3); //Calculating the total marks
if(total_marks>=125)
System.out.println("The grade will be = You have Passed");
else
System.out.println("The grade will be = FAIL");
}
}