Thursday, 16 November 2017

C Program to Find the Volume and Surface Area of Cuboids


Code:

#include    stdio.h
#include    math.h

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

    printf("Enter value of width, length & height of the cuboids:\n");
    scanf("%f%f%f", &width, &length, &height);
    surfacearea = 2 *(width * length + length * height +
    height * width);
    volume = width * length * height;
    space_diagonal = sqrt(width * width + length * length +
    height * height);
    printf("Surface area of cuboids is: %.3f", surfacearea);
    printf("\n Volume of cuboids is : %.3f", volume);
    printf("\n Space diagonal of cuboids is : %.3f", space_diagonal);
    return 0;
}


Output:

Enter value of width, length & height of the cuboids :
 22 23 24
Surface area of cuboids is: 3172.000
Volume of cuboids is : 12144.000
Space diagonal of cuboids is : 39.862



More C Programs:












100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...