QBASIC PROGRAM TO FIND HCF AND LCM
CLS
INPUT ENTER ANY TWO NUMBERS; A, B
C = A
D = B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
L = C * D / B
PRINT H.C.F=; B
PRINT L.C.M=; L
END
Using Sub
DECLARE SUB HL(A,B)
CLS
INPUT ENTER ANY TWO NUMBERS; A, B
CALL HL(A,B)
END
SUB HL(A,B)
C = A
D = B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
L = C * D / B
PRINT H.C.F=; B
PRINT L.C.M=; L
END SUB
0 Comments