Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <windows.h>
  4. using namespace std;
  5. main()
  6. {
  7.  
  8. int a, b, c;
  9.  
  10. double p,S;
  11.  
  12.  
  13. cout<< "Witaj! Ten program oblicza pole dowolnego trojkata" << endl;
  14. cout << "Podaj bok a" << endl;
  15. cin>> a;
  16. system("cls");
  17. cout <<"Podaj bok b" << endl;
  18. cin>> b;
  19. system("cls");
  20. cout << "Podaj bok c" << endl;
  21. cin >> c;
  22. system("cls");
  23.  
  24.  
  25. if((a+b>c)&&(a+c>b)&&(b+c>a))
  26. {
  27. p=(a+b+c)/2;
  28. S=sqrt(p*(p-a)*(p-b)*(p-c));
  29. cout << "Pole trojkata wynosi: " <<S<<endl;
  30.  
  31. }
  32.  
  33. else
  34. {
  35. cout << "Taki trojkat nie istnieje ;p" << endl;
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. return 0;
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement