Reputation: 53
DECLARE SUB cube(!)
INPUT "Enter a length";l
CALL cube(l)
END
SUB cube(l)
area=6*l^2
PRINT "Area of a cube",area
END SUB
Upvotes: 0
Views: 880
Reputation: 1165
This snip describes calling a subroutine in QBasic to get the area of a cube:
DECLARE SUB Cube(L!)
INPUT "Enter a length"; L!
CALL Cube(L!)
END
SUB Cube (L!)
Area! = 6 * L! ^ 2
PRINT "Area of a cube"; Area!
END SUB
The ! declares a variable as single precision.
Upvotes: 2