Computer Science, asked by johnpaulhilson025, 8 months ago

Write a Java program to find the volume of a cube.(volume=a^3).Read the value from the user.

Answers

Answered by Anonymous
3

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

Define the value of variable 'a' as the length of an edge of the cube.

Multiply 'a' with 'a' and again multiple the results with 'a' to obtain the volume of the cube.

Define the variable volume_cube and assign the volume of the cube to it.

Similar questions