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