Help - Want to add two numbers using for loop

Pages: 12
Nov 1, 2019 at 11:47am
result+= X;

I am only asking if there is any other way to multiply without using this logic
Nov 1, 2019 at 11:50am
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?
Nov 1, 2019 at 11:54am
No this isn't. I just want a "straight forward" answer to a simple question asked above your post. THATS IT.
Nov 1, 2019 at 11:57am
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?
Nov 2, 2019 at 10:56am
Thanks everyone, now I am stuck on division and remainder using same ops ++ and - -. lastchance need your assistance one last time.
Thanks
Nov 2, 2019 at 11:46am
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 Nov 2, 2019 at 11:48am
Nov 2, 2019 at 12:06pm
lastchance can you please provide a sample code for division? I’ll do for remainder.
Nov 2, 2019 at 12:21pm
Have a try, yourself. That way you will start to understand loops.

It's not a bad exercise on program control, actually.
Nov 2, 2019 at 12:28pm
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 Nov 2, 2019 at 12:29pm
Nov 4, 2019 at 11:31am
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