You are on page 1of 1

STEP 1: start step 2: read the numbers whose lcm and gcd is to be found into an array.

step 3: gcd=a[0] i=1 if i<3 calling function gcdd(gcd,a[0]) recursively. incrementing i by 1 step 4: Similar to step3 Taking lcm=a[0] i=1 & if i<3 calling function lcmf(lcm,a[i]) recursively step 5: displaying GCD and LCM FUNCTION gcdd(m,n) step 1: start step 2: if m<n t=m m=n n=t step 3: r=m%n if r!=0 then m=n & n=r otherwise return n go to step 2 step 4: stop FUNCTION lcmf(m,n) step 1: start step 2: calling function gcdd to lr step 3: lcm=m*n/lr step 4: returning lcm step 5: stop

You might also like