I have a question on a very basic operation of modulo operator.
Why does 1 % 9 produce 1? If 10 % 9 then remainder is 1.

I am very poor in math but have had to use modulo operator
many times before but always become confused and couldn't
understand the logic when dividend is smaller than divisor.

Thank you.

Recommended Answers

All 2 Replies

Well 9 divides into 1 zero times with 1 left over.

Well 9 divides into 1 zero times with 1 left over.

I got the point.
Thank you very much for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.