fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. #define N 100
  5.  
  6. int main() {
  7. int n, r, c;
  8. cin >> n;
  9. int arr[N][N];
  10. for (int i = 0; i < n; i++) {
  11. for (int j = 0 ; j < n; j++)
  12. cin >> arr[i][j];
  13. }
  14. cin >> r >> c;
  15. for (int i = 0; i < r; i++) {
  16. for (int j = 0; j < c; j++) {
  17. cout << arr[i][j] << " ";
  18. } cout << endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 15232KB
stdin
4
1 2 3 4
5 6 7 8
9 1 2 3
4 5 6 7
3 2
stdout
1 2 
5 6 
9 1