Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Tyler Elliott
- Assignment #3
- 9/5/2018
- */
- #include <stdio.h>
- #include <math.h>
- int main(){
- int height, depth, width;
- int areaTop, areaFront, areaEnd, areaPrism;
- int perimBot, perimFront, perimEnd;
- int volPrism;
- int diagL2R, diagT2B, diagF2B;
- printf("Enter in the height\n");
- scanf("%d", &height);
- printf("Enter in the depth\n");
- scanf("%d", &depth);
- printf("Enter in the width\n");
- scanf("%d", &width);
- printf("Measurements entered: \nHeight: %d \n Depth: %d \n Width: %d\n\n", height, depth, width);
- //Areas
- areaTop = width * depth;
- areaFront = width * height;
- areaEnd = height * depth;
- areaPrism = areaEnd*2 + areaFront*4;
- printf("Surface Area Measurements: \n SA of the Top: %d \n SA of the Front: %d \n SA of an end: %d\nSA of entire prism: %d\n\n", areaTop, areaFront, areaEnd, areaPrism);
- //Perimeters
- perimBot = width*2 + depth * 2;
- perimFront = width * 2 + height * 2;
- perimEnd = depth * 2 + height * 2;
- printf("Perimeter Measurements: \nPerimeter of bottom: %d \n Perimeter of front: %d \nPerimeter of an end: %d\n\n", perimBot, perimFront, perimEnd);
- //Volume
- volPrism = height * depth * width;
- printf("Volume of Prism: %d\n\n", volPrism);
- //Diagonal Distance
- diagL2R = sqrt(pow(depth, 2)* pow(width, 2));
- diagT2B = sqrt(pow(height, 2) * pow(width, 2));
- diagF2B = sqrt(pow(depth, 2) * pow(height, 2));
- printf("Diagonal Distance: \nLeft to Right: %g \n Top to Bottom: %g \n Front to Back: %g\n\n", diagL2R, diagT2B, diagF2B);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement