fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main ()
  4. { /* variable definition: */
  5. float base, height, perimeter;
  6. /* Prompt user for base */
  7. printf("Enter the base of the triangle: \n");
  8. // Input the base
  9. scanf("%f",&base);
  10. /* Prompt user for height */
  11. printf("Enter the height of the triangle: \n");
  12. // Input the base
  13. scanf("%f",&height);
  14. // Calculate the Perimeter
  15. perimeter = base + height + sqrt(base * base + height * height);
  16. // Print the result
  17. printf("Perimeter of right angled triangle is: %.3f", perimeter);
  18.  
  19. return 0;
  20. }
  21.  
  22.  
  23.  
Success #stdin #stdout 0s 9416KB
stdin
Standard input is empty
stdout
Enter the base of the triangle: 
Enter the height of the triangle: 
Perimeter of right angled triangle is: 0.000