Advertisement
a53

Inaltimi2

a53
Jul 1st, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main()
  5. {
  6. double AB,BC,AC,p,A,hA,hB,hC;
  7. cin>>AB>>BC>>AC;
  8. if(AB+BC>=AC && AB+AC>=BC && BC+AC>=AB)
  9. {
  10. p=(AB+BC+AC)/2;
  11. A=sqrt(p*(p-AB)*(p-BC)*(p-AC));
  12. hA=(2*A)/BC;
  13. hB=(2*A)/AC;
  14. hC=(2*A)/AB;
  15. int h1=hA*100,h2=hB*100,h3=hC*100;
  16. cout<<h1/100<<"."<<h1/10%10<<h1%10<<" ";
  17. cout<<h2/100<<"."<<h2/10%10<<h2%10<<" ";
  18. cout<<h3/100<<"."<<h3/10%10<<h3%10;
  19. }
  20. else
  21. cout<<"Imposibil";
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement