Invitation to Computer Science 8th Edition

Published by Cengage Learning
ISBN 10: 1337561916
ISBN 13: 978-1-33756-191-4

Chapter 1 - Exercises - Page 39: 10b

Answer

b) We can't divide by zero. It is enough to add an extra step after Step 1 Step 2 If $J=0$ then print out an answer, which will be a value of $I .$

Work Step by Step

b) In the case of inputs 0 and 32 then we would have to divide by zero which is not possible. It would not even make sense to look for the greatest common divisor in this case since it will always be the number which is not $0 .$ It is enough to add an extra step after Step 1 $[\text { Step } 2]$ If $J=0$ then print out an answer, which will be a value of $I$.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.