The gcd program of Example 1.20 might also be written int main() { int i = getint(), j = getint(); while (i != j) { if (i > j) i = i % j; else j = j % i; } putint(i); } Does this program compute the...



The gcd program of Example 1.20 might also be written


int main() {


int i = getint(), j = getint();


while (i != j) {


if (i > j) i = i % j;


else j = j % i;


}


putint(i);


}


Does this program compute the same result? If not, can you fix it? Under


what circumstances would you expect one or the other to be faster?



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here