Operators in C | Set 2 ( Relational and Logical Operators ) | C ++ program to demonstrate working of logical operators ; greater than example ; greater than equal to ; less than example ; lesser than equal to ; equal to ; not equal to
#include <iostream> NEW_LINE using namespace std ; int main ( ) { int a = 10 , b = 4 ; if ( a > b ) cout << " a ▁ is ▁ greater ▁ than ▁ b STRNEWLINE " ; else cout << " a ▁ is ▁ less ▁ than ▁ or ▁ equal ▁ to ▁ b STRNEWLINE " ; if ( a >= b ) cout << " a ▁ is ▁ greater ▁ than ▁ or ▁ equal ▁ to ▁ b STRNEWLINE " ; else cout << " a ▁ is ▁ lesser ▁ than ▁ b STRNEWLINE " ; if ( a < b ) cout << " a ▁ is ▁ less ▁ than ▁ b STRNEWLINE " ; else cout << " a ▁ is ▁ greater ▁ than ▁ or ▁ equal ▁ to ▁ b STRNEWLINE " ; if ( a <= b ) cout << " a ▁ is ▁ lesser ▁ than ▁ or ▁ equal ▁ to ▁ b STRNEWLINE " ; else cout << " a ▁ is ▁ greater ▁ than ▁ b STRNEWLINE " ; if ( a == b ) cout << " a ▁ is ▁ equal ▁ to ▁ b STRNEWLINE " ; else cout << " a ▁ and ▁ b ▁ are ▁ not ▁ equal STRNEWLINE " ; if ( a != b ) cout << " a ▁ is ▁ not ▁ equal ▁ to ▁ b STRNEWLINE " ; else cout << " a ▁ is ▁ equal ▁ b STRNEWLINE " ; return 0 ; }