Skip to main content

Relational Operators

1 min read Updated June 30, 2026
Share:
On this page (9sections)

Relational Operators

  • It Compare two operands and depending upon the their relation.

Syntax

Op1 Operator Op2

Example :

a > b

There are six relational operators. They are,

  • < less than
  • > greater than
  • <= less than or equal to
  • >= greater than or equal to
  • == equal to
  • != not equal to

Example of Relational Operator Program

/*  Example Program For Relational Operator In C Programming Language
    little drops @ thiyagaraaj.com
    Coded By:THIYAGARAAJ MP             */

// Header Files
#include<stdio.h>
#include<conio.h>

//Main Function
int main()
{
	// Variable Declaration
	int a = 25, b = 5;
	
	if( a>b )
	printf (?A is Big?);
	else
	printf (?A and B are Equal or B is Big?);

	// Wait For Output Screen
	getch();

	//Main Function return Statement
	return 0;
}

Output

A is Big.

How It Works

This C program demonstrates Relational Operators. It first prepares the data it needs, then uses conditional logic to decide the result, and finally prints the output shown in the Sample Output above.

  1. Declare the variables that hold the program’s data.
  2. Use conditional statements to handle the different cases.
  3. Print the final result to the console so you can compare it with the sample output.

Try changing the input values and re-running the program to see how the output changes — this is the fastest way to understand how the logic behaves.

Continue learning with these related tutorials and programs:

Frequently Asked Questions

What does this C program do?
It is a C example program that demonstrates Relational Operators, including the complete source code and the expected sample output.
How do I compile and run this C program?
Save the code in a `.c` file, compile it with `gcc filename.c -o program`, then run it with `./program` (or `program.exe` on Windows).
What concepts does this example use?
This example uses conditional logic, illustrating a common pattern in C programming.

Related Tutorials

Search tutorials