Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define NMAX 23
- int n, k, arr[NMAX][NMAX];
- int main() {
- cin >> n >> k;
- int col = 1;
- for (int i = 1; i <= n; i++) {
- for (int j = 0; j < n; j++) {
- for (int kk = 0; kk < k; kk++) {
- arr[i][col] = i + j;
- col++;
- }
- }
- col = 1;
- }
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j <= n * k; j++) {
- cout << arr[i][j] << ' ';
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement