I solve an euclidus algorythm, that explain in book of D. Knut. I beginer in c++, and try to understand, what is wrong. T | Sololearn: Learn to code for FREE!
0

I solve an euclidus algorythm, that explain in book of D. Knut. I beginer in c++, and try to understand, what is wrong. T

Give me advice, pls) https://code.sololearn.com/cKu74XGSu75U/?ref=app

29th Dec 2018, 10:46 AM
Š”ŠµŃ€Š³ŠµŠ¹ ŠšŠ»ŠøŠ¼Š¾Š²
Š”ŠµŃ€Š³ŠµŠ¹ ŠšŠ»ŠøŠ¼Š¾Š² - avatar
2 Answers
+ 2
The problem is r. It is set in this line: if (m < n){r = m; m = n; n = r; r = 1;} But what happens if m >= n. r will have no value.
2nd Jan 2019, 11:49 AM
Paul
Paul - avatar
0
No, if m >= n we already found solve. "if" skip by program
22nd Jan 2019, 8:05 PM
Š”ŠµŃ€Š³ŠµŠ¹ ŠšŠ»ŠøŠ¼Š¾Š²
Š”ŠµŃ€Š³ŠµŠ¹ ŠšŠ»ŠøŠ¼Š¾Š² - avatar