January 9, 2017

Qbasic program to enter any two numbers and display the 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 "HCF:", B
PRINT "LCM:", L
END

3 comments:

  1. please post qbasic program to find lcm only of given integers by using for next loop

    ReplyDelete
    Replies
    1. once try this:

      CLS
      INPUT "Enter the first number: ", a, b
      c = a
      d = b
      FOR i = b TO b
      t = a MOD b
      a = b
      b = t
      NEXT i
      l = (c * d) / b
      PRINT "LCM is "; l
      END

      Delete
  2. How does the q basic program finding hcf and lcm of two number works. Show me method. Take a =5 and b=3. Plz el reply fast

    ReplyDelete

Note: Only a member of this blog may post a comment.