ulvis.paste.net

Paste Search Dynamic
Recent pastes
calculate the area of a trapez
  1. // C code
  2. // This program will calculate the area of a trapezoid.
  3. // Developer: Kris Mollenhauer, CMIS102, Week 2 Hand’s-on Lab
  4. // Date: Feb 1, 2019
  5. #include <stdio.h>
  6.  
  7. int main ()
  8. {
  9.   /* variable definition: */
  10.   float baseA, baseB, height, area;
  11.   /* Prompt user for baseA */
  12.   printf("3 \n");
  13.   // Input the baseA
  14.   scanf("%f", &baseA);
  15.   /* Prompt user for baseB */
  16.   printf("4 \n");
  17.   // Input the baseB
  18.   scanf("%f", &baseB);
  19.   /* Prompt user for height */
  20.   printf("5 \n");
  21.   // Input the height
  22.   scanf("%f", &height);
  23.   // Calculate the Area
  24.   area= 0.5 * (baseA+ baseB) * height;
  25.   // Print the result
  26.   printf("Area is : %f\n", area);
  27.   return 0;
  28. }
  29.  
Parsed in 0.003 seconds