Javatpoint Logo
Javatpoint Logo

Set a variable without using Arithmetic, Relational or Conditional Operator

We are given three variables, a, b, and c, and our task is to set the value of x without using any arithmetic, relational and conditional operators. We need to follow the below rules.

Method to Follow

Example

Arithmetic Operators C++ Code

Output:

JTP1 + JTP2= 13
JTP1 - JTP2 = 7
JTP1 * JTP2 = 30
JTP1 / JTP2 = 3
JTP1 % JTP2 = 1

Relational Operators

S.no Relational operator Description of operators Example snippet
1 == Equal To operator x == y
2 != Not Equal To the operator x != y
3 < Less Than operator x < y
4 <= Less Than or Equal To the operator x <= y
5 > Greater Than operator x > y
6 >= Greater Than or Equal To the operator x >= y

Conditional Operators

Output:

The largest number between 5 and 10 is 10

Set a Variable without using Arithmetic, Relational or Conditional Operator

C++ code

Output:

45

C++ code

Output:

7






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA