Thursday 16 September 2021

Write a program to input base and height of the triangle from user. The program should calculate and display the area of triangle using SUB – END SUB statement.

 

a.     Write a program to input base and height of the triangle from user. The program should calculate and display the area of triangle using SUB – END SUB statement.(Hint: A=1/2bh)

 

DECLARE SUB Triangle( )

CLS

        CALL Triangle

END

SUB Triangle

        INPUT "Enter a base of triangle"; b

        INPUT "Enter a height of triangle"; h

        LET Area = (1/2) *b*h

        PRINT "Area of triangle is", Area

END SUB

       

No comments:

Post a Comment

MCQ Question Bank Microsoft PowerPoint