Sunday, 7 August 2016

NESTED IF STATEMENT

#include <stdio.h>
int main ()
{
       int a = 100;                                    /* local variable definition */
       int b = 200;
       if( a == 100 )                                 /* check the boolean condition */
       {                                                    /* if condition is true then check the following */
              if( b == 200 )
              {                                              /* if condition is true then print the following */
                      printf("The two conditions are true, Value of a is 100 and b is 200\n" );
              }
       }
        printf("Exact value of a is : %d\n", a );
        printf("Exact value of b is : %d\n", b );
      
        return 0;
}

output :
The two conditions are true, Value of a is 100 and b is 200
Exact value of a is : 100
Exact value of b is : 200

No comments:

Post a Comment

smhjifrivly@gmail.com