- To find the surface area of a sphere. (Qbasic Code)
INPUT "Enter radius of sphere"; r
LET pie = 3.14
A = 4 * pie * r ^ 2
PRINT "The total surface area of the sphere is"; A
END
- Using SUB Procedure
CLS
INPUT "Enter radius of the sphere"; r
CALL tsa(r)
END
SUB tsa (r)
LET pie = 3.14
A = 4 * pie * r ^ 2
PRINT "The total surface area of the sphere is"; A
END SUB
- Using FUNCTION Procedure
CLS
INPUT "Enter radius of the sphere"; r
PRINT "The total surface area of the sphere is"; TSA(r)
END
FUNCTION TSA (r)
LET pie = 3.14
A = 4 * pie * r ^ 2
TSA = A
END FUNCTION