Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define EPS 1e-7;
- using namespace std;
- const int N = 100;
- int a[N][N];
- int main ()
- {
- int n, m, i, j, c = 0, t = 1;
- cin >> n >> m;
- for ( i = 1; i <= n; i ++ )
- {
- for ( j = 1; j <= m; j ++ )
- {
- a[i][j] = t;
- t ++;
- }
- }
- for ( i = 1; i <= n; i ++ )
- {
- if ( i % 2 == 0 )
- for ( j = m; j >= 1; j -- )
- {
- cout << a[i][j] <<" ";
- }
- else
- for ( j = 1; j <= m; j ++ )
- {
- cout << a[i][j] <<" ";
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement