WAP to calculate and print area of four walls. | QBASIC Programming

Question: Write the correct program to calculate and print the area of four walls of a rectangular room.


Normal Program:

CLS
REM to calculate and print area of four walls of a rectangular room
INPUT "Enter the length of wall"; l
INPUT "Enter the breadth of wall"; b
INPUT "Enter the height of wall"; h
A = 2*h*(l+b)
PRINT "The required area of four walls of a room ="; A
END



Sub Procedure:

DECLARE SUB Area(l!,b!,h!)
CLS
REM to calculate and print area of four walls of a rectangular room
INPUT "Enter the length of wall"; l
INPUT "Enter the breadth of wall"; b
INPUT "Enter the height of wall"; h
CALL Area(l,b,h)
END
SUB Area(l,b,h)
A = 2*h*(l+b)
PRINT "The required area of four walls of a room ="; A
END SUB



Function Procedure:

DECLARE FUNCTION Area(l!,b!,h!)
CLS
REM to calculate and print area of four walls of a rectangular room
INPUT "Enter the length of wall"; l
INPUT "Enter the breadth of wall"; b
INPUT "Enter the height of wall"; h
PRINT "The required area of four walls of a room ="; Area(l,b,h)
END
FUNCTION Area(l,b,h)
Area = 2*h*(l+b)
END FUNCTION



Output

Enter the length of wall? 8
Enter the breath of wall? 8
Enter the height of wall? 8
The required area of four walls of a room = 256

Post a Comment

0 Comments