Question
Convertthe above program to java Program 5: Example Relational operators We have six relational operators in C++: ==, !=, >, =, ,> ==returns true if
Convertthe above program to java
Program 5: Example Relational operators
We have six relational operators in C++: ==, !=, >, =, ,>
==returns true if both the left side and right side are equal
!=returns true if left side is not equal to the right side of operator.
>returns true if left side is greater than right.
returns>
>=returns true if left side is greater than or equal to right side.
=returns>
#include
#include
using namespace std;
int main(){
int num1 = 240;
int num2 =40;
if (num1==num2) {
cout\"num1>
}
else{
cout\"num1>
}
if( num1 != num2 ){
cout\"num1>
}
else{
cout\"num1>
}
if( num1 > num2 ){
cout\"num1>
}
else{
cout\"num1>
}
if( num1 >= num2 ){
cout\"num1>
}
else{
cout\"num1>
}
if( num1
cout\"num1>
}
else{
cout\"num1>
}
if( num1 =>
cout\"num1>
}
else{
cout\"num1>
}
//return 0;
getch();
}
Output:num1 and num2 are not equal
num1 and num2 are not equal
num1 is greater than num2
num1 is greater than or equal to num2
num1 is not less than num2
num1 is greater than num2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started