Else If ladder Statements in Java. | Coding Startup

Else If ladder Statements in Java.

Else If ladder Statements in Java.


100% Working Code and Projects.


if you need any help about project and Application Contact Shelly at:+917888361589.

Java code below :-

package CodingStartupAbheer;

import java.util.Scanner;

public class ElseIfLadder {

    public static void main(String[] Abheer) {
        Scanner Abheer1 = new Scanner(System.in);
        System.out.println("Enter the marks of English");
        int English = Abheer1.nextInt();
        System.out.println("Enter the marks of maths");
        int Maths = Abheer1.nextInt();
        int Total = English + Maths;
        if (Total < 90 && Total >= 100) {
            System.out.println("Grade is A");
        } else if(Total >80 && Total<=90)  {
            System.out.println("Grade is B");
        }else if(Total>70 && Total<=80)
        {
            System.out.println("Grade is C");
        }else if(Total>60 && Total<=70)
        {
            System.out.println("Grade is D");
        }else
        {
            System.out.println("Fail");
        }
    }

}


Output : 

Enter the marks of English
80
Enter the marks of maths
90
Grade is B



Explanation :-
                                     In this , if one condition is true then the statements inside that condition will be executed. if all the condition get false then the else part will be executed. 









Code Startup

Author & Editor

0 Comments:

Post a Comment