Find the Volume of Cube
#include <stdio.h>
int main() {
double side, volume;
printf("Enter the length of one side of the cube: ");
scanf("%lf", &side);
if (side >= 0) {
volume = side * side * side; // Calculate the volume of the cube
printf("The volume of the cube with side length %.2lf is %.2lf\n", side, volume);
} else {
printf("Invalid side length. Please enter a non-negative value.\n");
}
return 0;
}
Comments
Post a Comment