-->
Showing posts with label WAP to understand relational operator.. Show all posts
Showing posts with label WAP to understand relational operator.. Show all posts

WAP to understand relational operator.

//program to understand following relational operators
/*
1)greater than                  (>)
2) greater than or equals to    (>=)
3)smaller than                  (<)
4) smaller than or equals to    (<=)
5)equals to                     (==)
6) not equal to                 (!=)
*/
#include <iostream> //header file

using namespace std;//to handle all standard characters/functions,reserved words  used in program. we do not use in turboc++ compiler

int main()          //main function
{
    int number;
    cout << "enter a number" << endl;
    cin>>number;
    cout<<"number<20:-"<<(number<20)<<endl;//returns 0 or 1 if it is false or true
    cout<<"number<=20:-"<<(number<=20)<<endl;//returns 0 or 1 if it is false or true
    cout<<"number>20:-"<<(number>20)<<endl;//returns 0 or 1 if it is false or true
    cout<<"number>=20:-"<<(number>=20)<<endl;//returns 0 or 1 if it is false or true
    cout<<"number!=20:-"<<(number!=20)<<endl;//returns 0 or 1 if it is false or true
    cout<<"number==20:-"<<(number==20)<<endl;//returns 0 or 1 if it is false or true
    return 0;
}
//note:kindly put parentheses for expression(number<20); if we do not put then it does not work.