edited by
1,484 views

1 Answer

9 votes
9 votes

Cond 3 : Evaluating condition where two integers are equal and thus GCD(x,x)=x Thus it is returning X itself.
Cond 2 : We are reducing the Greater integer among 2 by the smallest one which will ultimately reduce it by factor of smaller integer.
Cond1: Provides updated value at other iteration and Original value at 1st iteration./

EX: M=9 N=6
L=9,K=6
Iteration 1 ::Cond 1 :(9! = 6)True --> (K>L)False --> L=3 -->Cond2::Cond1 (Updated value : L=3 K=6) 
Iteration 2 ::Cond1 :(3!=6) True --> (K>L)True --> K=3--> Cond2:: Cond1(Updated Value L=3,K=3)
Iteration 3 ::Cond1 (3!=3) False Cond 3 :: Return K=3 Which is GCD(9,6)=3

edited by

Related questions

4 votes
4 votes
2 answers
1
go_editor asked Dec 19, 2016
2,241 views
Consider the two program segments below:for i:=1 to f(x) by 1 do S endi:=1; While i<=f(x) do S i:=i+1 endUnder what conditions are these two programs equivalent? Treat $S...
0 votes
0 votes
1 answer
3
8 votes
8 votes
3 answers
4
go_editor asked Dec 20, 2016
3,277 views
Assume that the matrix $A$ given below, has factorization of the form $LU=PA$, where $L$ is lower-triangular with all diagonal elements equal to $1, U$ is upper-triangula...