To find HCF and LCM of any two numbers (Qbasic Code)

To find HCF and LCM of any two numbers (Qbasic Code)
  • 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
    END

Share :

Facebook Twitter Google+
Back To Top

facebook main

counter

Powered by Blogger.