+ 1

Dividing two numbers

Hello..i want to write a cpp program that Divides two numbers ( say it divides a by b) and the division continues till the Reminder equals zero. Could anyone tell me any idea?? i would appreciate any help..MANY THANKS

25th Nov 2018, 8:06 PM
RiGeL
RiGeL - avatar
6 Respostas
+ 6
If Danijel gives me the permission I wanna share this snippet with you! 8D For integer div you would do it this way int a, b; cout << "a = "; cin >> a; cout << "b = "; cin >> b; while ( cout << a << " / " << b << " = " << a / b << endl && (a /= b) && (a % b) ); Output_1: a = 15 b = 2 15 / 2 = 7 7 / 2 = 3 3 / 2 = 1 1 / 2 = 0 Output_2: a = 16 b = 2 16 / 2 = 8
25th Nov 2018, 8:57 PM
Babak
Babak - avatar
+ 11
C++ Soldier (Babak) Very nice my friend! 👌 You don't need my permission,👍😁😆 but I would like RiGeL to do it! Okay, 😉 we're here to help, if we can, of course! 😊 Have a nice Coding! ;) // I will remove my comment if you think I should! 👍
25th Nov 2018, 9:32 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 10
Please, if you want us to help you, then show us your attempt, what you don't understand exactly,  where you are struggling, it will be much easier!👍😉 Use the search bar! https://www.sololearn.com/post/10362/?ref=app Please, read our guidelines: https://www.sololearn.com/discuss/1316935/?ref=app An useful code for any new user here!;) https://code.sololearn.com/WvG0MJq2dQ6y/
25th Nov 2018, 8:35 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 9
C++ Soldier (Babak) 👍 I can't believe this...!? 😨 //-2 Now, 1 down, 1 to go! 😃✌
26th Nov 2018, 8:27 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 3
C++ Soldier (Babak) THANK YOU A BUNCH👍
25th Nov 2018, 9:02 PM
RiGeL
RiGeL - avatar
+ 2
"You don't need my permission,👍😁😆" Of course, I do! 8D "I will remove my comment if you think I should! 👍" Noooo, you're not gonna do that, dear! 8D It informs the OP about the correct way of asking for help and definitely helps him/her next time. Edit: Seems this one triggered some downvoters and brought me a sweet -2! 8D
26th Nov 2018, 5:44 AM
Babak
Babak - avatar