-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompOperators.c
26 lines (22 loc) · 920 Bytes
/
compOperators.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include<stdio.h>
int main(){
// == is equal to (used for comparison)
// fe
int x,y;
printf("Please enter the first number > ");
scanf("%d", &x);
printf("Please enter the second number > ");
scanf("%d", &y);
if(x == y){printf("They are equal numbers! \n");}
else{printf("They are not the same numbers. \n");}
// != is not equal to (used for comparison)
// > is greater than (used for comparison)
// < is less than (used for comparison)
// >= is greater than or equal to (used for comparison)
// <= is less than or equal to (used for comparison)
// && is and (used for comparison)
// || is or (used for comparison)
// ! is not (used for comparison)
// ? is ternary operator (used for comparison) if true returns left, else returns right
// ?: is ternary operator (used for comparison) checks if it is a null value
}