Relational and Equality operators


#include <iostream.h> int main() { int num1, num2; cout << "Enter two integers”; cin >> num1 >> num2; if ( num1 == num2 ) cout << num1 << " is equal to " << num2 << endl; if ( num1 != num2 ) cout << num1 << " is not equal to " << num2 << endl; if ( num1 < num2 ) cout << num1 << " is less than " << num2 << endl; if ( num1 > num2 ) cout << num1 << " is greater than " << num2 << endl; if ( num1 <= num2 ) cout << num1 << " is less than or equal to " << num2 << endl; if ( num1 >= num2 ) cout << num1 << " is greater than or equal to " << num2 << endl; return 0; }
   OUTPUT:
             Enter two Integers: 12 18
             12 is not equal to 18
             12 is less than 18
             12 is less than or equal to 18

No comments:

Post a Comment