Comparison Operators in C Language

Comparison Operators in C Language:

(1) Comparison Operators are used for comparing two variables

(2) Sample C language code and its output, as shown:

Sample C language code for Comparison Operators
#include <stdio.h>
#include <conio.h>
// Assignment Operators in C Language
int main()
{
int x;
int y;
  x = 5;
  y = 5;
printf(“x equals to y: %d\n”, x == y);
  x = 5;
  y = 6;
printf(“x not equals to y: %d\n”, x != y);
  x = 7;
  y = 6;
printf(“x greater than y: %d\n”, x > y);
x = 5;
  y = 6;
printf(“x lesserthan y: %d\n”,x< y);
x = 7;
  y = 6;
printf(“x greater than or equals to y: %d\n”, x >= y);
  x = 5;
  y = 6;
printf(“x less than or equals to y: %d\n”, x <= y);
getch();
return 0;
}

(3) After that go to the “Build” menu and select the “Build” option for publishing the code as shown.

click on build option for Assignment Operators code in c

(4) After building the code, press the “Run” button, as shown.

press on run button for Comparison Operators code in C 1

(5) After pressing the “run” button, the output screen is opened, as shown.

Comparison Operators in C Output screen
Comparison OperatorsDescription
==Equal to
!=Not Equal to
>Greater than
Less than
>=Greater than or equal to
<=Less than or equal to

Use of STORED PROCEDURES in SQL
Use of GROUP BY Statement in SQL
How to Take BACKUP from SQL Database
How to Fix 24 Hours or Military Time in BC D365
Format Property– Microsoft Docs

Leave a Reply