Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- double a, b, c, S, s;
- cout << "Zadejte delky stran trojuhelnika a, b, c:" << endl;
- cin >> a >> b >> c;
- if((a > 0) && (b > 0) && (c > 0)){
- s = (a + b + c)/2;
- S = sqrt(s * (s - a) * (s - b) * (s - c));
- if (S > 0)
- cout << "Obsah trojuhelnika je " << S << endl;
- else
- cout << "Nejedna se o platny trojuhelnik." << endl;
- }
- else
- cout << "Nejedna se o platny trojuhelnik."
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement