In most programming languages we differentiate between integral and floating point numbers.
If you do integral operation (+, -, *, /, %, etc) the result is also an integral number.
Similarly, the same arithmetic operations applied of floating point numbers will yield floating point results.
- 3/2 = 1 (only integral parts are kept for integral arithmetic)
- 3.0 / 2.0 = 1.5. (floating point arithmetic)
- 4/2 = 2 (integral arithmetic)
- 4.0 / 2.0 = 2.0 (and not 2 -- floating point arithmetic)
- 4 / 2.0 = 2.0 (if integrals and floating points are mixed, the result is floating point)
You can google around to see how exactly integral and floating point arithmetic work in C.
I hope this helped.