85,362 views
16 votes
16 votes
How to find HCF and LCM of a number in Q Basic program?? ​

User Guillaume D
by
2.4k points

1 Answer

22 votes
22 votes
CLS
INPUT "Enter the first number"; a
INPUT "Enter the second number"; b
m = a
n = b
WHILE a <> 0
r = b MOD a
b = a
a = r
WEND
l = (m * n) / b
PRINT "HCF is "; b
PRINT "LCM is "; l
User Alexanderbird
by
2.8k points