Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     const int W = 10;
  8.     const int H = 12;
  9.     int ar[H][W];
  10.    
  11.     int num = 1;
  12.     //заполнить
  13.     for(int i = H-1; i >= 0; i--)
  14.     {
  15.         if(i%(H-1) == 0)
  16.         {
  17.             for(int j = W-1; j >= 0; j--)
  18.             {
  19.                 ar[i][j] = num++;
  20.             }
  21.         }
  22.         else
  23.         {
  24.             for(int j = 0; j < W; j++)
  25.             {
  26.                 ar[i][j] = num++;
  27.             }
  28.         }
  29.     }
  30.     //вывести
  31.     for(int i = 0; i < H; i++)
  32.     {
  33.         for(int j = 0; j < W; j++)
  34.         {
  35.             cout << ar[i][j] << "\t";
  36.         }
  37.         cout << endl;
  38.     }
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement