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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!