QBASIC – Easily find volume of a cube

Table of Contents

Program

Below is the QBASIC program to calculate the volume of a cube.

REM Program to find volume of a cube
CLS
INPUT "Enter the length: "; l
volume = l ^ 3
PRINT "Volume of cube is: ";volume
END

Output

Volume of a cube QBASIC

Explanation

Let’s first see the formula:  Volume = l ^ 3. So, we can determine the volume of a cube by taking the length from the user and raising the power of length by 3 or calculating the cube of length (l ^ 3).

Note: All sides are equal in a cube, hence only ask the length of a cube from the user.

More Programs

https://thinkshare.one/learn/programming/qbasic/

Leave a Comment

Your email address will not be published. Required fields are marked *