Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <conio.h>
  4. using namespace std;
  5.  
  6. int main ()
  7. {
  8.     int i, j, max;
  9.     int N = 4;
  10.     double a[N][N];
  11.    
  12.     for (i = 0; i < N; ++i)
  13.     {
  14.         for (j = 0; j < N; ++j)
  15.         {
  16.             a[i][j] = rand() % 10;
  17.             cout << a[i][j] << "  ";
  18.             }
  19.         cout << endl;
  20.         }
  21.     max = a[0][0];
  22.     for (i = 0; i < N; ++i)
  23.     {
  24.         for (j = 0; j < N; ++j)
  25.         {            
  26.             if ((j >= i) && (a[i][j] > max))
  27.             max = a[i][j];
  28.             }          
  29.         }
  30.     cout << endl;
  31.     cout << "maximal'noe znachenije ravno " << max;
  32.      
  33.     getch ();
  34.     return 0;
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement