Wednesday, October 13, 2021

QBASIC Program to print the area of triangle (with SUB/FUNCTION Procedure)

CLS
INPUT "Enter Breadth : "; b
INPUT "Enter Height : "; h
a = 1 / 2 * (b * h)
PRINT "Area of Triangle is "; a
END


Using SUB Procedure

DECLARE SUB area(b,h)
CLS
INPUT "Enter Breadth : "; b
INPUT "Enter Height : "; h
CALL area(b, h)
END

SUB area (b, h)
     a = 1 / 2 * (b * h)
     PRINT "Area of Triangle is "; a
END SUB


Using FUNCTION Procedure

DECLARE FUNCTION area(b,h)
CLS
INPUT "Enter Breadth : "; b
INPUT "Enter Height : "; h
a = area(b, h)
PRINT "Area of Triangle is "; a
END

FUNCTION area (b, h)
     a = 1 / 2 * (b * h)
     area = a
END FUNCTION

No comments:

Post a Comment

If you have any doubts, Please let me know.

[Download PDF] Computer Science Book Gread-10 in Nepali Language

 If you are searching for class 10 Computer Science in Nepali pdf for free download then you are at the right page. This book is soley publi...