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