Simen Kjaeraas:

Both 5 and 9 in the second example are integers (int). When you divide
one int by another, the result is an int, and hence (5/9) is 0.

Yes, smarter languages (like Pascal..., but also Python, Ada, etc) have two different division operators to avoid such silly C semantics, that sometimes causes bugs.

Bye,
bearophile

Reply via email to