Example program of Comparison Operators

C Programming Language / Operators and Enums in C Language

1129

Program:

#include <stdio.h>
int main() {
	int a,b;
	a = 10;
	b = 6;
	printf("%d == %d = %d\n",a,b,a==b);
	printf("%d != %d = %d\n",a,b,a!=b);
	printf("%d > %d = %d\n",a,b,a>b);
	printf("%d < %d = %d\n",a,b,a<b);
	printf("%d >= %d = %d\n",a,b,a>=b);
	printf("%d <= %d = %d\n",a,b,a<=b);
	return 0;
}

Output:

10 == 6 = 0
10 != 6 = 1
10 > 6 = 1
10 < 6 = 0
10 >= 6 = 1
10 <= 6 = 0
Press any key to continue . . .

Explanation:


This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.