Relational operators in C:
Relational operators are used to find the relation between two variables. i.e. to compare the values of two variables in a C program.
S.no

Operators

Example

Description

1

>

x > y

x is greater than y

2

<

x < y

x is less than y

3

>=

x >= y

x is greater than or equal to y

4

<=

x <= y

x is less than or equal to y

5

==

x == y

x is equal to y

6

!=

x != y

x is not equal to y

 In this program, relational operator (= =) is used to compare 2 values whether they are equal are not.
 If both values are equal, output is displayed as ” values are equal”. Else, output is displayed as “values are not equal”.
 Note : double equal sign (= =) should be used to compare 2 values. We should not single equal sign (=).
Output:
m and n are not equal

http://cprogrammingandandroid.blogspot.com/2014/01/waptomatrixsubtraction.html
ReplyDelete#include
ReplyDeletemain()
{
int r,p;
scanf("%d",&r);
scanf("%d",&p);
if(r==p)
{
printf("r and p are equal");
}
else
{
printf("r and p are not equal");
}
}
#include
ReplyDeletemain()
{
int r,p;
scanf("%d",&r);
scanf("%d",&p);
if(r==p)
{
printf("r and p are equal");
}
else
{
printf("r and p are not equal");
}
}
#include
ReplyDeletemain()
{
int r,p;
scanf("%d",&r);
scanf("%d",&p);
if(r==p)
{
printf("r and p are equal");
}
else
{
printf("r and p are not equal");
}
}
#include
ReplyDeletemain()
{
int r,p;
scanf("%d",&r);
scanf("%d",&p);
if(r==p)
{
printf("r and p are equal");
}
else
{
printf("r and p are not equal");
}
}