-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElseIfExample.java
More file actions
35 lines (32 loc) · 964 Bytes
/
ElseIfExample.java
File metadata and controls
35 lines (32 loc) · 964 Bytes
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
import java.util.Scanner;
public class ElseIfExample {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter Your Percentage");
float percentage=sc.nextFloat();
/*
* 0-49 Fail
* 50-59 Satisfactory
* 60-69 Fair
* 70-79 Good
* 80-100 Exellent
*/
if(percentage>=0 && percentage<=100)
{
if(percentage<50)
System.out.println("Fail");
else if(percentage<60)
System.out.println("Satisfactory");
else if(percentage<70)
System.out.println("Fair");
else if(percentage<80)
System.out.println("Good");
else
System.out.println("Exellent");
}
else
{
System.out.println("Invalid Percentage Please Try Again!");
}
}
}