Write a program to use various relation operator and display their return value.

return value
#include<stdio.h>
#include<conio.h>
int main()
{
	printf("\n Condition : Return Values\n");
	printf("\n 10!=10 : %5d",10!=10);
	printf("\n 10==10 : %5d",10==10);
	printf("\n 10>=10 : %5d",10>=10);
	printf("\n 10<=10 : %5d",10<=10);
	printf("\n 10!=9 : %5d",10!=9);
	getch();
}

The program demonstrates the use of various relational operators in C programming. Relational operators are used to compare two values and return a Boolean value (either 0 or 1) based on the result of the comparison. The program uses printf() function to print the return value of each relational operator.

The output of the program will be: Condition : Return Values 10!=10 : 0 10==10 : 1 10>=10 : 1 10<=10 : 1 10!=9 : 1

Here, the relational operator ! = returns 0 if the values being compared are equal and 1 if they are not equal. The relational operator == returns 1 if the values being compared are equal and 0 if they are not equal. The relational operator >= returns 1 if the first value is greater than or equal to the second value, and 0 otherwise. The relational operator <= returns 1 if the first value is less than or equal to the second value, and 0 otherwise.

Thanks

Write a program to use various relation operator and display their return value.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top