Class 10 : Qbasic Project Work

  a. Write a program in QBASIC that asks length, breadth and height of room and calculate its area and volume. Create a user defined function to calculate area and sub-program to calculate volume. Hint: [A=L×B], [V=L×B×H]


DECLARE FUNCTION AREA(L,B)

DECLARE SUB VOL(L,B,H)

CLS

INPUT “Enter Length”; L

INPUT “Enter Breadth”; B

INPUT “Enter Height”; H

PRINT “Area of room=”; AREA(L,B)

CALL VOL(L,B,H)

END

FUNCTION AREA(L,B)

AREA = L * B

END FUNCTION

SUB VOL(L,B,H)

V=L*B*H

PRINT “Volume of Room=”; V

END SUB


B)  Write a program in QBASIC that asks radius and height of a cylinder Create a User Defined Function to calculate total surface area and a Sub Program to calculate the volume of a cylinder.

[Hint: TSA=2pr (r+h) and Volume pr2h]


DECLARE FUNCTION AREA(R, H)

DECLARE SUB VOL(R,H)

Cls

INPUT "Enter radius"; R

INPUT "Enter height"; H

PRINT AREA(R, H)

Call VOL(R, H)

END

FUNCTION AREA (R, H)

AREA = 2 * 3.14 * R * (R + H)

END FUNCTION


 SUB VOL (R, H)

 V = 3.14 * R ^ 2 * H

PRINT "Volume of cylinder"; V

END SUB


C) Write a program in QBASIC that asks radius of a circle to calculate its area and circumference.                 Create a user defined function to calculate area and sub program to calculate circumference.

[Hint A= pr2, C= 2pr]


DECLARE FUNCTION AREA (R)

DECLARE SUB CIR (R)


CLS

INPUT “ENTER RADIUS”; R

PRINT “AREA OF SQUARE ”; AREA(R)

CALL CIR (R)

END

FUNCTION AREA (R)

AREA = 3.14 * R ^ 2

END FUNCTION

SUB CIR (R)

C = 2 * 3.14 * R

PRINT “CIRCUMFERENCE OF CIRCLE”; C

END SUB


D. Write a program in Q-BASIC that asks length and breadth of a room and calculate its area and perimeter. Create a user-defined FUNCTION to calculate area and SUB program to calculate perimeter. [Hint: A=L×B, P=2(L+B)]


DECLARE FUNCTION AREA(L,B)

DECLARE SUB PER(L,B)


CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

PRINT “AREA OF A ROOM=”; AREA(L,B)

CALL PER(L,B)

END


FUNCTION AREA(L,B)

AREA=L*B

END FUNCTION


SUB AREA(L,B)

P=2*(L+B)

PRINT “PERIMETER OF RECTANGLE=”; P

END SUB 

Written By

Helping Students Succeed • •Free Book Solutions and Study Guides • sandesh_Shiwakoti