Relational operator

Relational operator

<, >, <=, >=, ==, !=

It is also called comparison operator. It is used to compare two variable or values. It is used to make conditions.

Relational operators always return true or false.

Syntax

left-operan operator right-operand

NOTE: turbo c++ does not support bool data type therefore you can use int data type to hold 0 or 1.


<

It is called less than operator. It compare two variable or values.

Example: p = m < n;

In this example, If m is less than n then return true and assign to p otherwise it return false and assign to p.


>

It is called greater than operator. It compare two variable or values.

Example: p = m > n;

In this example, If m is greater than n then return true and assign to p otherwise it return false and assign to p.


<=

It is called less than or equal operator. It compare two variable or values.

Example: p = m <= n;

In this example, If m is less than or equal to n then return true and assign to p otherwise it return false and assign to p.


>=

It is called greater than or equal operator. It compare two variable or values.

Example: p = m >= n;

In this example, If m is greater than or equal to n then return true and assign to p otherwise it return false and assign to p.


==

It is called equal to operator. It compare two variable or values.

Example: p = m == n;

In this example, If m is equal to n then return true and assign to p otherwise it return false and assign to p.


!=

It is called not equal to operator. It compare two variable or values.

Example: p = m != n;

In this example, If m is not equal to n then return true and assign to p otherwise it return false and assign to p.


See Output

About Us

Comsysapp.com is an educational website. Students and software developers can learn programming language tutorials. Comsysapp is very useful for beginners and professional developers. Comsysapp provides tutorial in easy language. Comsysapp.com has focus on simplicity.

Services

Comsysapp.com provides free tutorials like c, html, css, etc. All tutorials are free for beginner and professionals.


Terms of Use

comsysapp.com is not responsible for any mistake. We are not responsible if information made available on our website is incomplete or invalid. But comsysapp.com always try for zero-zero mistake.

Privacy policy

comsysapp.com does not collect any data from users. We use Google AdSense advertising on our website. We never ask personal or private information.


Sitemap

sitemap

copyright © 2023