In this program we are going to check whether
a number is greater is greater or not using if esle if.
//check greater number
class ElseIf1{
public static void main(String args[]){
int a=50;
if(a>10){
System.out.println("Value of x is greater 10");
}
else if(a>60){
System.out.println("Value of x is greater 60");
}
else if(a>70){
System.out.println("Value of x is greater 70");
}
else{
System.out.println("None of above condition is valid");
}
}
}
//check greater number
class ElseIf1{
public static void main(String args[]){
int a=50;
if(a>10){
System.out.println("Value of x is greater 10");
}
else if(a>60){
System.out.println("Value of x is greater 60");
}
else if(a>70){
System.out.println("Value of x is greater 70");
}
else{
System.out.println("None of above condition is valid");
}
}
}
No comments:
Post a Comment