29 lines
659 B
Java
29 lines
659 B
Java
|
|
public class ElseIf {
|
||
|
|
public static int main() {
|
||
|
|
int x = 75;
|
||
|
|
|
||
|
|
if (x >= 90) {
|
||
|
|
System.out.println("A");
|
||
|
|
} else if (x >= 80) {
|
||
|
|
System.out.println("B");
|
||
|
|
} else if (x >= 70) {
|
||
|
|
System.out.println("C");
|
||
|
|
} else if (x >= 60) {
|
||
|
|
System.out.println("D");
|
||
|
|
} else {
|
||
|
|
System.out.println("F");
|
||
|
|
}
|
||
|
|
|
||
|
|
int y = 50;
|
||
|
|
if (y > 100) {
|
||
|
|
System.out.println("Over 100");
|
||
|
|
} else if (y > 50) {
|
||
|
|
System.out.println("Over 50");
|
||
|
|
} else {
|
||
|
|
System.out.println("50 or less");
|
||
|
|
}
|
||
|
|
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
}
|