fork(1) download
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main(void) {
  4. /* varaiable definition */
  5. float base1, base2, height, perimeter;
  6. printf("Enter the first base of the trapezoid: 4.5 \n");
  7. base1 = 4.5;
  8. scanf("%f", &base1);
  9. printf("Enter the second base of the trapezoid: 5.5 \n");
  10. base2 = 5.5;
  11. scanf("%f", &base2);
  12. printf("Enter the height of the trapezoid: 6.5 \n");
  13. height = 6.5;
  14. scanf("%f", &height);
  15. perimeter = base1 + base2 + height + sqrt(height * height + (base2 - base1 * base2 - base1));
  16. printf("perimeter is: %f \n", perimeter);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 4444KB
stdin
Standard input is empty
stdout
Enter the first base of the trapezoid: 4.5 
Enter the second base of the trapezoid: 5.5 
Enter the height of the trapezoid: 6.5 
perimeter is: 20.801163