calculate grade of students according to their marks in java

//make a user define class
class StudentsGrade{
 public static void main(String[] args) {
//take a user input as student marks
 int marks = Integer.parseInt(System.console().readLine("Enter the marks of student :"));
    if(marks>90 && marks<100){
 System.out.println("A Grade");
 }
 else if(marks>70&&marks<90){
         System.out.println("B Grade");
  }
  else if(marks >50 &&  marks<70){
     System.out.println("C Grade");
 }
        else if(marks<50){
  System.out.println("Fail");
  }
    }
 }

/* save the file as StudentsGrade.java , compile
 and run using cmd
*/
/*
output :
Enter the marks of student :
88
B Grade
*/

Post a Comment

1 Comments

  1. Great post! For those seeking quality education, K.R. Mangalam University offers excellent academic programmes with a focus on holistic development.

    ReplyDelete