Nearby lessons

17 of 72

C - Arithmetic Operators

Arithmetic Operators is one of the foundational topics in C programming. This lesson explains Arithmetic Operators (+ - * / %) and Program: all five arithmetic operators with complete, runnable code examples, clear step-by-step explanations, and common mistakes to avoid with exam-style MCQs at the end.

Arithmetic Operators (+ - * / %)

These do the basic maths. First see the full table, then run the complete program.

OperatorMeaningExampleResult
+Addition5 + 27
-Subtraction5 - 23
*Multiplication5 * 210
/Division5 / 22 (integer division)
%Modulo (remainder)5 % 21
Trainer's Note: Integer division trap: 5 / 2 gives 2, not 2.5, because both are integers — C drops the decimal part. If you want 2.5, make at least one operand a float: 5.0 / 2 or 5 / 2.0. The % operator gives the remainder and works only on integers.

Program: all five arithmetic operators

Example02
Loading editor…
📝 Key Takeaways
  • Operators: arithmetic (+ - * / %), relational (== != < > <= >=), logical (&& || !), assignment (= += -= *= /= %=), ++ --, ternary ?:.
  • Each operator family has its own complete program — copy and run one at a time.
  • Integer division drops decimals: 5/2 = 2; use 5.0/2 for 2.5.
  • % gives the remainder and works only on integers.
  • a++ uses then increases; ++a increases then uses.
  • Ternary: condition ? value1 : value2.
  • Use brackets to control the order of evaluation.

🧠 Test Your Knowledge

3 Questions
Progress: 0 / 3

Finished this lesson?

Mark it as complete to track your progress and see technology completion stats.