+ 5

C++

How can we find common factors of two integers?

28th Sep 2017, 6:09 AM
Aman jain
Aman jain - avatar
10 odpowiedzi
+ 13
This works for n integer: https://code.sololearn.com/cheiBr290ubx Note: Your last number must be 0 to terminate the loop
28th Sep 2017, 6:27 AM
Babak
Babak - avatar
+ 10
That's not my code dear. I usually don't use preprocessor directives for defining constants.
28th Sep 2017, 9:15 AM
Babak
Babak - avatar
+ 8
Don't be upset Swim! ;) I mentioned to source website for clarification. BTW, congratulations for teacher badge! @~)~~~~
28th Sep 2017, 11:11 AM
Babak
Babak - avatar
+ 7
Because a lot of learners expect you to provide them answers real quick. So as a result in some rare cases I have to borrow others code [those that are outside of SL- like tutorial websites etc] That's a good thing in fact. But it really depends on your point of view of sharing and that kinds of things. Good luck Teacher. ;)
28th Sep 2017, 3:01 PM
Babak
Babak - avatar
28th Sep 2017, 6:24 AM
Kartikey Sahu
Kartikey Sahu - avatar
+ 1
@Babak, why "define TRUE 1" when Cpp has bool type ? :o
28th Sep 2017, 8:33 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
I think you are true @Babak, but the code you shared is not bad practice proof :/
28th Sep 2017, 3:30 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
Oh ok, I thought so ! Sorry, my mistake !
28th Sep 2017, 9:25 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar