Tuesday 14 January 2014

Explain Relational operator with example.

It check relation between two constant values.If relation is true it returns 1 otherwise 0.
The operators are >=,<=,<,>,==,!=.


Write a program to use all relational operator and display thier return values.

#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
printf("  \n Condition : Return value  ");
printf("  \n 10!=10 :%5d  ",10!=10);  /* not equal to */
printf("  \n 10<=10 :%5d  ",10<=10);  /* less than or equal too */
}

Output

Condition : Return Value
   10!=10 : 0
   10<=10 : 1

No comments:

Post a Comment