Wednesday, October 16, 2019

80. Qbasic program to print HCF and LCM


80.      Write a program in QBASIC to input any two different number and print HCF and LCM using SUB………END SUB

DECLARE SUB HCF(A, B)
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
CALL HCF (A, B)
END

SUB HCF (A, B)
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
PRINT "H.C.F="; B
END SUB

No comments:

Post a Comment