QBASIC Program To Find The Area OF Triangle

 QBASIC Program To Find The Area OF Triangle


QBASIC Program To Find The Area OF Triangle
Flowchart to find the area of triangle

Algorithm To Find The Area of Triangle
Step1: Start
Step2: Accept/Input breadth and height of the triangle and store them in two different variables b, h
Step3: Calculate area = 1/2*b*h
Step4: Display the area of the triangle
Step5: End the program

 

QBASIC Program To Find The Area OF Triangle

CLS
INPUT “Enter base”; B
INPUT “Enter height”; H
Area= (1/2)*B*H
PRINT " The area of triangle is"; Area
END

Algorithm To Find The Area of Triangle Using Sub Procedure in QBASIC

Step1: Start
Step2: Declare the sub procedure with a name and parameters as Area (b, h)
Step3: Accept/Input breadth and height of the triangle and store them in two different variables b, h
Step4: Call the sub procedure declared in the step2 with CALL statement as CALL Area (b, h)
Step5: End the program
Step6: Define the sub procedure
Step7: In the sub procedure, calculate the area of the triangle
Step8: Display the area of the triangle
Step9: End the sub procedure




QBASIC Program To Find The Area OF Triangle using SUB Procedure 

DECLARE SUB AREA (B, H)
CLS
INPUT “Enter base”; B
INPUT “Enter height”; H
CALL AREA(B, H)
END
SUB AREA (B, H)
AREA = (1/2) * B * H
    PRINT " The area of triangle is "; AREA
END SUB

Algorithm To Find The Area of Triangle Using Function Procedure in QBASIC

Step1: Start
Step2: Declare the function procedure with name and parameters as Area (l, b)
Step3: Accept/Input breadth and height of the triangle and store them in two different variables b, h
Step4: Call the function procedure declared in the step2 with a variable or PRINT Statement
Step5: End the program
Step6: Define the function procedure
Step7: In the function procedure, calculate the area of the triangle
Step8: Assign the value of the area to the function name
Step9: End the function procedure


QBASIC Program To Find The Area OF Triangle Using FUNCTION Procedure

DECLARE FUNCTION AREA (B, H)
CLS
INPUT “Enter base”; B
INPUT “Enter height”; H
PRINT “Area of a triangle”; AREA (B, H)
END
FUNCTION AREA (B, H)
AREA = (1/2) * B * H
END FUNCTION  


Comments