Answer to Question #317995 in Algorithms for asdasd

Question #317995

Solve for the Greatest Common Divisor (GCD) of the following pair of numbers using the Pseudocode of Euclidean Algorithm given



below. (Show your complete solution.)



while n ≠ 0 do



r ← m mod n



m ← n



n ← r



return m




1. GCD (248, 16)

1
Expert's answer
2022-03-25T12:09:52-0400
GCD(248, 16):
initial values: m = 248, n = 16

while n != 0 do  :      16 != 0
    r <- m mod n :      r <- 248 mod 16 = 8
    m <- n       :      m <- 16
    n <- r       :      n <- 8

while n != 0 do  :      8 != 0
    r <- m mod n :      r <- 16 mod 8 = 0
    m <- n       :      m <- 8
    n <- r       :      n <- 0

while n != 0 do  :      0 == 0

return m         :      return 8

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS