Showing posts with label What is Relational Operator in python. Show all posts
Showing posts with label What is Relational Operator in python. Show all posts

Friday, 30 September 2022

What is Relational Operator in C++, JavaScript, Python, C Language |What is Relational Operator in Programming Language |What is Operator in programming Language |C++ Operators |How Many Operators are in C++ Language |What is Operators in Computer |What is Relational Operator in Computer



-:   Relational Operators  :-

     Operators are those symbols which are used between operands to perform Mathematical and Logical operations.

    Relational Operators are those symbols which are used to establish a relationship and compare the values of Two operands.

In the relational operator following symbols are used -
[ <, >, ==, !=, <=, >= ]

_________________________________________________________
see an example of relational operator-

#include<iostream>
using namespace std ;
int main() {
    int a=5, b=10 ;       
       if(a==b) 
            cout<<"both a and b are equal" ;
       else
            cout<<"a and b are not equal" ;
    return 0 ;
} 
_________________________________________________________
Output:-        a and b are not equal. 
_________________________________________________________
_________________________________________________________
see one another example and compare it with the example given above - 
#include<iostream>
using namespace std ;
int main() {
    int a=5, b=5 ;        //here a and b both are equal. 
       if(a==b) 
            cout<<"both a and b are equal" ;
       else
            cout<<"a and b are not equal" ;
    return 0 ;
}
_________________________________________________________
Output:-          both a and b are equal. 
_________________________________________________________


let's understand that actually what is happening above - 

    We took two variables named "a" and "b", both of these variables containing integer type data. Now we established a relation (==) between these two variables. 
     if ( after establishing the relation we gave a condition that if both variables are equal so what to do. we said that if values of both variables are equal so do this 👉 simply print a statement "both a and b are equal" in output screen.) 
 
    else(after establishing the relation we gave a condition that if both variables are not equal so what to do. we said that if values of both variables are not equal so do this 👉 simply print a statement "a and b are not equal" in output screen.) 

prog1:-   in the 1st program, 5 and 10 are not equal, so we got  "a and b are not equal" in the output screen. 

prog2:-   in the 2nd program, 5 and 5 are equal, so we got  "both a and b are equal" in the output screen. 




MUST SEE :-