If-Else Ladder Statement, Marksheet Grade Card

Java Programming Language / Decision Making in java

3777

Program:

 class IfElseladder {
    public static void main(String[] args)
    {

        int marks = 88;
        char grade;

        if (marks >= 90) {
            grade = 'A';
        } else if (marks >= 80) {
            grade = 'B';
        } else if (marks >= 70) {
            grade = 'C';
        } else if (marks >= 60) {
            grade = 'D';
        } else {
            grade = 'F';
        }
        System.out.println("Grade = " + grade);
    }
}

  

Output:

Grade = B
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.