To find out the area of rectangle. (Qbasic Code)

  • CLS
    INPUT "Enter the lenght of rectangle"; l
    INPUT "Enter the breadth of rectangle"; b
    a = l * b
    PRINT "The area of rectangle is"; a
    END

Using SUB Procedure 
DECLARE SUB area(l,b)
CLS
INPUT "Enter the lenght of rectangle"; l
INPUT "Enter the breadth of rectangle"; b
CALL area(l, b)
END

SUB area (l, b)
a = l * b
PRINT "The area of rectangle is"; a
END SUB


Using FUNCTION Procedure
DECLARE FUNCTION area (l, b)
CLS
INPUT "Enter the length of rectangle"; l
INPUT "Enter the breadth of rectangle"; b
PRINT "The area of rectangle is"; area(l, b)
END

FUNCTION area (l, b)
a = l * b
area = a
END FUNCTION

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.