Page 32 - 6437
P. 32

#include <stdio.h>


                 main()
                 {

                    int a = 5;
                    int b = 20;

                    int c ;


                    if ( a && b )
                    {

                        printf("Line 1 - Condition is true\n" );
                    }

                    if ( a || b )
                    {

                        printf("Line 2 - Condition is true\n" );
                    }

                    /* lets change the value of  a and b */
                    a = 0;

                    b = 10;
                    if ( a && b )

                    {
                        printf("Line 3 - Condition is true\n" );

                    }
                    else

                          Try the following example to understand all the logical operators available in C:


























                                                                                                      34
   27   28   29   30   31   32   33   34   35   36   37