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
#include <iostream> NEW_LINE using namespace std ; int main ( ) { int a = 10 , b = 4 , c = 10 , d = 20 ; if ( a > b && c == d ) cout << " a ▁ is ▁ greater ▁ than ▁ b ▁ AND ▁ c ▁ is ▁ equal ▁ to ▁ d STRNEWLINE " ; else cout << " AND ▁ condition ▁ not ▁ satisfied STRNEWLINE " ; if ( a > b c == d ) cout << " a ▁ is ▁ greater ▁ than ▁ b ▁ OR ▁ c ▁ is ▁ equal ▁ to ▁ d STRNEWLINE " ; else cout << " Neither ▁ a ▁ is ▁ greater ▁ than ▁ b ▁ nor ▁ c ▁ is ▁ equal ▁ " " ▁ to ▁ d STRNEWLINE " ; if ( ! a ) cout << " a ▁ is ▁ zero STRNEWLINE " ; else cout << " a ▁ is ▁ not ▁ zero " ; return 0 ; }