Advertisement
elltyl325

Assignment #3

Sep 5th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.54 KB | None | 0 0
  1. /*
  2.     Tyler Elliott
  3.     Assignment #3
  4.     9/5/2018
  5.    
  6. */
  7. #include <stdio.h>
  8. #include <math.h>
  9.  
  10. int main(){
  11.    
  12.     int height, depth, width;
  13.     int areaTop, areaFront, areaEnd, areaPrism;
  14.     int perimBot, perimFront, perimEnd;
  15.     int volPrism;
  16.     int diagL2R, diagT2B, diagF2B;
  17.    
  18.     printf("Enter in the height\n");
  19.     scanf("%d", &height);
  20.     printf("Enter in the depth\n");
  21.     scanf("%d", &depth);
  22.     printf("Enter in the width\n");
  23.     scanf("%d", &width);
  24.     printf("Measurements entered: \nHeight: %d \n Depth: %d \n Width: %d\n\n", height, depth, width);
  25.    
  26.     //Areas
  27.     areaTop = width * depth;
  28.     areaFront = width * height;
  29.     areaEnd = height * depth;
  30.     areaPrism = areaEnd*2 + areaFront*4;
  31.     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);
  32.    
  33.     //Perimeters
  34.     perimBot = width*2 + depth * 2;
  35.     perimFront = width * 2 + height * 2;
  36.     perimEnd = depth * 2 + height * 2;
  37.     printf("Perimeter Measurements: \nPerimeter of bottom: %d \n Perimeter of front: %d \nPerimeter of an end: %d\n\n", perimBot, perimFront, perimEnd);
  38.    
  39.     //Volume
  40.     volPrism = height * depth * width;
  41.     printf("Volume of Prism: %d\n\n", volPrism);
  42.    
  43.     //Diagonal Distance
  44.     diagL2R = sqrt(pow(depth, 2)* pow(width, 2));
  45.     diagT2B = sqrt(pow(height, 2) * pow(width, 2));
  46.     diagF2B = sqrt(pow(depth, 2) * pow(height, 2));
  47.     printf("Diagonal Distance: \nLeft to Right: %g \n Top to Bottom: %g \n Front to Back: %g\n\n", diagL2R, diagT2B, diagF2B);
  48.    
  49.    
  50.    
  51.    
  52.    
  53.    
  54.     return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement