Answers for "C++ Area of Triangle"

C++
1

C++ Area of Triangle

//uisng Heron's Formula
    float first, second, third, semiperimeter, area;

    cout << "Input the first side of the triangle: ";
    cin >> first;
    cout << "Input the first side of the triangle: ";
    cin >> second;
    cout << "Input the third side of the triangle: ";
    cin >> third;

    semiperimeter = (first + second + third)/2;
    area = sqrt (semiperimeter*(semiperimeter-first)*(semiperimeter-second)*(semiperimeter-third));

    cout << "The area of the triangle is " << area << endl;
Posted by: Guest on March-09-2022

Code answers related to "C++ Area of Triangle"

Browse Popular Code Answers by Language