C Tutorial · Chapter 9 of 16
C Operators
Compute and compare values.
Arithmetic operators: + - * / %. Comparison operators: == != < > <= >=.
Use == for comparison. A single = assigns a value.
Operators sample
Try it Yourself »
#include <stdio.h>
int main(void) {
int a = 10;
int b = 3;
printf("Sum = %d\n", a + b);
printf("Remainder = %d\n", a % b);
return 0;
}
Classroom Tips
- Integer division truncates decimals.
- Parentheses make order of operations clearer.