fork download
  1. #include <stdio.h>
  2.  
  3. int main ()
  4. {
  5. /* variable definition: */
  6. float base, height, area;
  7.  
  8. /* Prompt user for base */
  9. printf("Enter the base of the triangle: \n");
  10.  
  11. // Input the base
  12. scanf("%f", &base);
  13.  
  14. /* Prompt user for height */
  15. printf("Enter the height of the triangle: \n");
  16.  
  17. // Input the base
  18. scanf("%f", &height);
  19.  
  20. // Calculate the Area
  21. area= 0.5 * (base * height);
  22.  
  23. // Print the result
  24. printf("Area is : %f\n", area);
  25. printf("The base of the triangle : %f\n", base);
  26. printf("The height of the triangle : %f\n", height);
  27.  
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
Enter the base of the triangle: 
Enter the height of the triangle: 
Area is : 0.000000
The base of the triangle : 0.000000
The height of the triangle : 0.000000