Advertisement
JosepRivaille

X59091: Rectangles (2)

Mar 14th, 2015
1,210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. //Pre: Llegeix diversos naturals
  6. //Post: Omple un rectangle d'NxM amb succecions de 9-0
  7. int main() {
  8.     int n, m, x, f;
  9.     f = 0;
  10.     while (cin >> n) {
  11.         cin >> m;
  12.         if (f != 0) cout << endl;
  13.         x = 9;
  14.         for (int i = n; i != 0; --i) {
  15.             for (int j = m; j != 0; --j) {
  16.                 cout << x;
  17.                 if (x > 0) --x;
  18.                 else x = 9;
  19.             }
  20.             cout << endl;
  21.         }
  22.         ++f;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement