Only loops, or are if statements allowed?
Not that I'll hand out code on homework, but I can say that both division and remainder can easily be done at once with a loop and an if statement.
Just think about division actually represents, taking a total and dishing it out evenly.
Hint, you can take user entered variables as the number of times to run a loop.
You can get quotent by doing multimplication backward — substract divisor from dividend, keeping a running count, until youcannot substract without going into negatives:
570 - 57 - 57 - ... - 57 = 0. As 57 repeats 10 times, 570/57 is 10. Remainder would be found in similar way:
44 - 6 - 6 - 6 - 6 - 6 - 6 - 6 = 2. As 6 repeats 7 times and in the end result is 2 then 44/6 is 7 and 44%6 is 2.
I'd use a while loop (not a do while for this). Simple algorithm would go like this.
Check if the right hand number is negative.
If it is, store this and make it positive.
Declare a loop counter which starts at 0
Declare a total which starts at 0
while the loop counter is less than the second user inputted number, add the first user inputted number to the total
If the right hand number was negative, take the total away from 0.