QBASIC Program To Find The Area of Rectangle

 QBASIC Program To Find The Area of Rectangle

QBASIC Program To Find The Area of Rectangle
Algorithm To Find The Area of Rectangle
Step1: Start
Step2: Accept/Input length and breadth and store them in two different variables l and b
Step3: Calculate area = l * b
Step4: Display the area of rectangle
Step5: End the program

QBASIC Program To Find  The Area of a rectangle

CLS
INPUT “Enter length of the rectangle ”; L
INPUT “Enter breadth of the rectangle”; B
A = L * B
PRINT “Area of the rectangle ”; A
END


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

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


QBASIC Program To Find The Area of a rectangle using Sub Procedure


DECLARE SUB  AREA (L, B)
CLS
INPUT “Enter length of the rectangle ”; L
INPUT “Enter breadth of the rectangle”; B
CALL AREA(L, B)
END

SUB AREA (L, B)
A = L * B
PRINT “The area of the rectangle is ”; A
END SUB


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

Step1: Start
Step2: Declare the function procedure with name and parameters as Area (l, b)
Step3: Accept/Input length and breadth and store them in two different variables l and b
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 rectangle
Step8: Assign the value of the area to the function name
Step9: End the function procedure

QBASIC Program To Find The Area of a rectangle  using Function Procedure


DECLARE FUNCTION AREA (L, B)
CLS
INPUT “Enter length of the rectangle ”; L
INPUT “Enter breadth of the rectangle”; B
PRINT “Area of the rectangle ”; AREA(L, B)
END

FUNCTION AREA (L, B)
A = L * B
AREA = A
END FUNCTION

Comments