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