Help - Want to add two numbers using for loop

Pages: 12
result+= X;

I am only asking if there is any other way to multiply without using this logic
You... you've completely ignored everything keskiverto, lastchance and I have been telling you, haven't you?

Youve already been shown how you can do an addition as a series of ++ operations. Why are you pretending you haven't?

You've already been show how you can do a series of such additions to do a multiplication. Why are you pretending you haven't?

Or is this just an elaborate troll?
No this isn't. I just want a "straight forward" answer to a simple question asked above your post. THATS IT.
You take the technique you've been shown for doing an addition using ++.

You then use an outer loop to do multiple such additions, to perform a multiplication.

How is this not straightforward?
Thanks everyone, now I am stuck on division and remainder using same ops ++ and - -. lastchance need your assistance one last time.
Thanks
Well, if you can do addition, then you can count how many times you can add Y to 0 so as to equal (or, at least, not exceed) X. That will give integer divide X / Y and, with care, a remainder to. Just count your quotient and remainder.
Last edited on
lastchance can you please provide a sample code for division? I’ll do for remainder.
Have a try, yourself. That way you will start to understand loops.

It's not a bad exercise on program control, actually.
Actually I am a bit aware of the logic but I am out of city and tonight is the last day to submit this program. Please try to understand. You can get me full marks.
Last edited on
You're acutally asking us openly to help you cheat on your homework, so you can get a score you didn't deserve?
Topic archived. No new replies allowed.
Pages: 12