Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

C++ Area of Scalene Triangle

    float a, b, c, d, e;
    
    cout << "Finding the Area of Scalene Triangle using Heron's Formula
";
    cout << "1st Side of a Triangle: ";
    cin >> a;  
    cout << "2nd Side of a Triangle: ";
    cin >> b;
    cout << "Angle Between Sides: ";
    cin >> c;

    e = 0.5 *  (a + b + c); 	//(a + b + c) / 2
    d = sqrt(e*(e-a)*(e-b)*(e-c));

    cout << "The area is: " << d << endl;
 
PREVIOUS NEXT
Tagged: #Area #Scalene #Triangle
ADD COMMENT
Topic
Name
6+3 =