Advertisement
Guest User

Untitled

a guest
Oct 11th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. double a, b, c, S, s;
  10. cout << "Zadejte delky stran trojuhelnika a, b, c:" << endl;
  11. cin >> a >> b >> c;
  12. if((a > 0) && (b > 0) && (c > 0)){
  13. s = (a + b + c)/2;
  14. S = sqrt(s * (s - a) * (s - b) * (s - c));
  15. if (S > 0)
  16. cout << "Obsah trojuhelnika je " << S << endl;
  17. else
  18. cout << "Nejedna se o platny trojuhelnik." << endl;
  19. }
  20. else
  21. cout << "Nejedna se o platny trojuhelnik."
  22.  
  23.  
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement