Shell script to find LCM of the given two numbers?

1 answer

Answer

1233625

2026-07-12 20:55

+ Follow

Shell program to find LCM and hcf of two no.s

tput clear

echo "Enter first no"

read a

echo "Enter 2nd no"

read b

p= 'expr $a \* $b'

while [$b -ne 0]

do

r= 'expr $a % $b'

a=$b

b=$r

done

LCM = 'expr $p / $a'

echo "LCM = $LCM"

echo "Hcf = $a"

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.