Introduction
Relational operators help us compare two values to see how they relate, like if one is bigger, smaller, or equal to the other.
expression1 operator expression2
if (a == b) { /* code */ }
if (x != y) { /* code */ }
if (score >= 50) { /* code */ }
if (age < 18) { /* code */ }
#include <stdio.h> int main() { int a = 10; int b = 20; if (a < b) { printf("a is less than b\n"); } if (a != b) { printf("a is not equal to b\n"); } if (b >= 20) { printf("b is greater than or equal to 20\n"); } if (a == 10) { printf("a is equal to 10\n"); } return 0; }
a is not equal to variable b in C?int a = 5, b = 10;
if (a > b) {
printf("True\n");
} else {
printf("False\n");
}int x = 7, y = 3;
if (x =< y) {
printf("x is less or equal to y\n");
}int a = 4, b = 4, c = 5;
if (a == b && b < c) {
printf("Yes\n");
} else {
printf("No\n");
}Pass the test and this pattern moves unknown