Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n;
- cin >> n;
- int a[n + 5][n + 5];
- int x = 1;
- for(int i = 1; i <= n; i++){
- if(i % 2 != 0){
- for(int j = 1; j <= n; j++){
- a[i][j] = x;
- x++;
- }
- }else{
- for(int j = n; j >= 1; j--){
- a[i][j] = x;
- x++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement