fork download
  1. // C code
  2. // This program will calculate the area 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 base, height, area;
  11. /* Prompt user for base */
  12. printf("Enter the base of the triangle: \n");
  13. // Input the base
  14. scanf("%10.1", &base);
  15. /* Prompt user for height */
  16. printf("Enter the height of the triangle: \n");
  17. // Input the base
  18. scanf("%12.2", &height);
  19. // Calculate the Area
  20. area= 0.5 * (10.1 * 12.2);
  21. // Print the result
  22. printf("Area is : %f\n", area);
  23. return 0;
  24. }
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
Enter the base of the triangle: 
Enter the height of the triangle: 
Area is : 61.610001