text: Operators in C | Set 2 ( Relational and Logical Operators ) | C program to demonstrate working of logical operators ; logical AND example ; logical OR example ; logical NOT example
code: #include <stdio.h> NEW_LINE int main ( ) { int a = 10 , b = 4 , c = 10 , d = 20 ; if ( a > b && c == d ) printf ( " a ▁ is ▁ greater ▁ than ▁ b ▁ AND ▁ c ▁ is ▁ equal ▁ to ▁ d STRNEWLINE " ) ; else printf ( " AND ▁ condition ▁ not ▁ satisfied STRNEWLINE " ) ; if ( a > b c == d ) printf ( " a ▁ is ▁ greater ▁ than ▁ b ▁ OR ▁ c ▁ is ▁ equal ▁ to ▁ d STRNEWLINE " ) ; else printf ( " Neither ▁ a ▁ is ▁ greater ▁ than ▁ b ▁ nor ▁ c ▁ is ▁ equal ▁ " " ▁ to ▁ d STRNEWLINE " ) ; if ( ! a ) printf ( " a ▁ is ▁ zero STRNEWLINE " ) ; else printf ( " a ▁ is ▁ not ▁ zero " ) ; return 0 ; }