Advertisement
Lisaveta777

Supereasy

Dec 22nd, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.16 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <math.h>
  5.  
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     setlocale(LC_ALL, "RUS");
  12.     {int a[4][4];
  13.     for (int i = 0; i < 4; i++)
  14.         for (int j = 0; j < 4; j++)
  15.             cin >> a[i][j];
  16.     for (int i = 0; i < 4; i++)
  17.     {
  18.         for (int j = 0; j < 4; j++)
  19.             cout << a[i][j] << " ";
  20.         cout << "\n";
  21.     }
  22.     }
  23.             double sr = 0, k = 0;
  24.             int a[4][4];
  25.             for (int i = 0; i < 4; i = i + 1)
  26.                 for (int j = 0; j < 4; j = j + 1) {
  27.                     {if (i + j >= 4 && a[i][j] < 0) sr = sr + a[i][j], k = k + 1,cout<<"HERE"; }
  28.                    
  29.                 }
  30.                
  31.             cout << "sr before=" << sr << endl;
  32.             cout << "k berofe=" << k << endl;
  33.             sr = sr / k;
  34.             cout << "sr=" << sr << endl;
  35.             cout << "k=" << k << endl;
  36.             int i=1;
  37.             double p = 1;
  38.             for (int j = 0; j < 4; j = j + 1) {
  39.                 p = p * (cos(fabs(a[1][j]) + 3 * j));
  40.             }
  41.             cout << "p=" << p << endl;
  42.             for (i = 0; i < 4; i = i + 1)
  43.             {
  44.                 double s = 0;
  45.                 double c[4];
  46.                 for (int j = 0; j < 4; j = j + 1)
  47.                     s = s + a[i][j];
  48.                 {c[i] = s;
  49.                 }
  50.                 cout << setw(10) << "c[i]" << endl;
  51.                 for (i = 0; i < 4; i = i + 1)
  52.                 {
  53.                     cout << setw(10) << c[i] << endl;
  54.                 }
  55.             }
  56.  
  57.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement