-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIfElseIfExample.java
More file actions
41 lines (37 loc) · 1.06 KB
/
Copy pathIfElseIfExample.java
File metadata and controls
41 lines (37 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.firstjavaprg;
import java.util.Scanner;
/**
*
* @author my
*/
public class IfElseIfExample {
public static void main(String[] args) {
System.out.println("enter marks got by student");
Scanner sc=new Scanner(System.in);
int marks = sc.nextInt();
if(marks<50){
System.out.println("fail");
}
else if(marks>=50 && marks<60){
System.out.println("D grade");
}
else if(marks>=60 && marks<70){
System.out.println("C grade");
}
else if(marks>=70 && marks<80){
System.out.println("B grade");
}
else if(marks>=80 && marks<90){
System.out.println("A grade");
}else if(marks>=90 && marks<100){
System.out.println("A+ grade");
}else{
System.out.println("Invalid!");
}
}
}