fork download
  1. /// C code
  2. // This program will calculate the perimiter of a triangle.
  3. // Developer: Steven Frasson
  4. // Date: May 26, 2017
  5.  
  6. #include <stdio.h>
  7.  
  8. int main ()
  9. {
  10. /* variable definition: */
  11. float a, b, c, perimiter;
  12.  
  13. /* Explain formula */
  14. printf("The perimiter of a traingle is the summation of each of its sides. \n");
  15.  
  16. /* Prompt user for length of side a */
  17. printf("Enter length of side a: \n");
  18.  
  19. // Input side a length
  20. scanf("%f", &a);
  21.  
  22. /* Prompt user for base */
  23. printf("Enter length of side b: \n");
  24.  
  25. // Input side b length
  26. scanf("%f", &b);
  27.  
  28. /* Prompt user for length of side c */
  29. printf("Enter length of side c: \n");
  30.  
  31. // Input the side c length
  32. scanf("%f", &c);
  33.  
  34. // Calculate the Perimiter
  35. perimiter= a + b + c;
  36.  
  37. // Print the result
  38. printf("Perimiter is : %f\n", perimiter);
  39.  
  40. return 0;
  41. }
  42.  
Success #stdin #stdout 0s 10320KB
stdin
10
5
7
stdout
The perimiter of a traingle is the summation of each of its sides. 
Enter length of side a: 
Enter length of side b: 
Enter length of side c: 
Perimiter is : 22.000000