stoyan genchev - 1 year ago 95

C++ Question

I am trying to find out how many times % has substracted a number from another.

For an example if 256 % 50 = 6, then the iterations have been 5? 256 - 50 - 50 - 50 - 50 - 50.

If 145 % 40 = 25, then the iterations have been 3. 145 - 40 - 40 - 40.

I am looking for a solution to the problem without usiong any kind of loop, recursion or goto.

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

What you're looking for is the `/`

operator.

Try the division operator instead of the modulus operator. Works every time. It's fundamental math.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**