fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double base, height, area;
  6.  
  7. cout << "Enter the base of the triangle: ";
  8. cin >> base;
  9.  
  10. cout << "Enter the height of the triangle: ";
  11. cin >> height;
  12.  
  13. area = 0.5 * base * height;
  14.  
  15. cout << "The area of the triangle is: " << area << endl;
  16.  
  17. return 0;
  18. }
  19.  
  20.  
  21.  
  22.  
Success #stdin #stdout 0.01s 5288KB
stdin
45
stdout
Enter the base of the triangle: Enter the height of the triangle: The area of the triangle is: 1.56445e-308