0
What is the mean of nested here?
4 Réponses
+ 10
Nested if-else statements means one can use an if or an else if statement inside another if or else if statement.
+ 9
/*These if statments are all nested inside the body of the first if statement as long as all the statments return true the last if statment will execute the println method 😉*/
int i = 1;
if(i ==1){
if(i%1==0){
if(i*2/2 ==1){
if(i!=2){
if(i>0){
if(i<2){
if(i>0&&i<2){
if(0*i+1==1){
if(i!=i/2){
System.out.print("yep thats a "+i);}}}}}}}}
}
else{System.out.println("Number is not 1");}
+ 2
nested is use when in some code we find out the result
for example:- finding the maximum number from 3 numbers ?
so here is the c++ code:-
int a=5,int b=7,int c=3;
if(a>b&&a>c)
cout<<"a is greater";
elseif(b>c&&b>a)
cout<<"b is greater";
else(c>a&&c>b)
cout<<"c is greater";