You are currently viewing WAP to Calculate the volume of a box

WAP to Calculate the volume of a box

  • Post category:C Programs
Share this to everyone:
#include <stdio.h>

int main() {
    float length, width, height, volume;

    // Prompt the user to enter the dimensions of the box
    printf("Enter the length of the box: ");
    scanf("%f", &length);
    printf("Enter the width of the box: ");
    scanf("%f", &width);
    printf("Enter the height of the box: ");
    scanf("%f", &height);

    // Calculate the volume
    volume = length * width * height;

    // Print the result
    printf("The volume of the box is: %.2f\n", volume);

    return 0;
}

Leave a Reply