Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // cpp program to determine the area of a triangle from its sides..
- #include "iostream"
- using namespace std;
- int main() {
- int x, y, z;
- cout << "Sides of that triangle : ";
- cin >> x >> y >> z;
- double p;
- if ((x+y) > z && (y+z) > x && (x+z) > y)
- p = (x + y + z) / 2.0;
- else {
- cout << "Invalid Input has given. Try again! \n" << endl;
- main();
- }
- double area = p * (p - x) * (p - y) * (p - z);
- cout << "Area : " << area << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement