nikolay7minecraft

homework2-3

Sep 18th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. // Example program
  2. #include <iostream>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.   double a;
  9.   double b;
  10.   double c;
  11.   double p;
  12.   double s;
  13.  
  14.   cout << "a=";
  15.   cin >> a;
  16.   cout << "b=";
  17.   cin >> b;
  18.   cout << "c=";
  19.   cin >> c;
  20.  
  21.  
  22.   if (a+b<c){
  23.       cout << "net takogo treugolnika" << endl;
  24.       }
  25.  
  26.   if (a+c<b){
  27.       cout << "net takogo treugolnika" << endl;
  28.       }
  29.      
  30.     if (c+b<a){
  31.       cout << "net takogo treugolnika" << endl;
  32.       }
  33.  
  34.   p=(a+b+c)/2;
  35.   cout << "p=";
  36.   cout << p << endl;
  37.   s=p*(p-a)*(p-b)*(p-c);
  38.   s=sqrt(s);
  39.   cout << "s=";
  40.   cout << s << endl;
  41.  
  42. }
Add Comment
Please, Sign In to add comment