Nested If else
package conditionalStatements;
public class NestedIfElse {
public static void main(String[] args) {
int a = 17, b = 9, c = 17 ;
int result = 0;
if(a>b) {
if(a>c) {
result = a;
}else {
result = c;
}
}else {
if(b>c) {
result = b;
}
else {
result = c;
} }
System.out.println("Largest Number is "+ result);
}
}
Comments
Post a Comment