-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNestedif.java
More file actions
26 lines (21 loc) · 827 Bytes
/
Nestedif.java
File metadata and controls
26 lines (21 loc) · 827 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
// Java Program to demonstrate the use of nested If Statement.
import java.util.Scanner;
public class Nestedif {
public static void main(String[] args){
System.out.println("Enter Age : ");
Scanner sc = new Scanner(System.in);
int age = sc.nextInt();
System.out.println("Enter weight : ");
int weight = sc.nextInt();
//Applying condition on age and weight.
if(age >= 18) {
if (weight >= 50) {
System.out.println("You are eligible to donate blood");
} else {
System.out.println("You are not eligible to donate blood");
}
} else {
System.out.println("Age must be greater than 18");
}
}
}