In C++, comparison operators are used to compare two values or expressions and return a Boolean value (true or false) based on whether the comparison is true or false. C++ provides the following comparison operators:
#include<iostream> using namespace std; int main() { int x=10,y=10; if(x==y) { cout<<"\nEqual to : "<<x; } return 0; }To download raw file Click Here
Equal to : 10
#include<iostream> using namespace std; int main() { int x=10,y=5; if(x>y) { cout<<"\nGreatest value : "<<x; } return 0; }To download raw file Click Here
Greatest Value: 10
#include<iostream> using namespace std; int main() { int x=10,y=5; if(x>=y) { cout<<"\nGreater than or equal to : "<<x; } return 0; }To download raw file Click Here
Greater than or equal to : 10
#include<iostream> using namespace std; int main() { int x=10,y=15; if(x<y) { cout<<"\nSmallest value : "<<x; } return 0; }To download raw file Click Here
Smallest value : 10
#include<iostream> using namespace std; int main() { int x=10,y=15; if(x<=y) { cout<<"\nSmaller than or equal to : "<<x; } return 0; }To download raw file Click Here
Smaller than or equal to :10
#include<iostream> using namespace std; int main() { int x=10,y=5; if(x!=y) { cout<<"\nNot Equal to : "<<x; } return 0; }To download raw file Click Here
Not equal to: 10
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions