Javatpoint Logo
Javatpoint Logo

Program to find the volume of the cube

The cube has all the edges of the same length. The volume of a cube can be calculated by multiplying the length of an edge by itself twice. So if the length of an edge is 4, the volume is 4 x 4 x 4 = 64

Algorithm

  1. Define the value of variable 'a' as the length of an edge of the cube.
  2. Multiply 'a' with 'a' and again multiple the results with 'a' to obtain the volume of the cube.
  3. Define the variable volume_cube and assign the volume of the cube to it.

Complexity

O(1)


Solution

C Program

Output:

Volume of the cube=64  

PHP Program

Output:

Volume of the cube=64  

Java Program

Output:

Volume ot the cube=64

C# Program

Output:

Volume of cube=64

Python Program

Output:

volume of the cube=64  

Next Topic#





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA