fork download
  1. // C code
  2. // This program will calculate the perimeter of a right triangle.
  3. // Developer: Faculty CMIS102
  4. // Date: Jan 31, XXXX
  5. #include <stdio.h>
  6.  
  7. int main ()
  8. {
  9. /* variable definition: */
  10. float a, b, c;
  11. int n;
  12. float perimeter;
  13.  
  14. printf("\n Perimeter of triangle n");
  15. printf("---------------------------n");
  16. printf("\n Enter the size of all sides of the triangle : ");
  17. scanf("%f%f%f", &a, &b, &c);
  18. perimeter = a + b + c;
  19. printf("Perimeter of triangle is: %.3f", perimeter);
  20. return 0;
  21. }
  22.  
  23.  
Success #stdin #stdout 0s 9416KB
stdin
12 7 2
stdout
 Perimeter of triangle n---------------------------n
 Enter the size of all sides of the triangle : Perimeter of triangle is: 21.000