C Program to Find the Volume of a Cube
Formula:
Volume of Cube = Side × Side × Side = side³
#include <stdio.h>
int main()
{
float side, volume;
printf(“Enter the side of the cube: “);
scanf(“%f”, &side);
volume = side * side * side;
printf(“Volume of cube = %.2f”, volume);
return 0;
}
Explanation
sidestores the side length entered by the user.volume = side * side * sidecalculates the cube’s volume.%.2fdisplays the answer up to 2 decimal places.