Advertisement
AshfaqFardin

2D Array (Input & Output)

Jul 30th, 2021
922
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int row = 4;
  8.     int column = 3;
  9.    
  10.     int arr[4][3];
  11.     int k = 1;
  12.     for(int i = 0; i < row; i++){
  13.         for(int j = 0; j < column; j++){
  14.             arr[i][j] = k;
  15.             k++;
  16.         }
  17.     }
  18.    
  19.     for(int i = 0; i < row; i++){
  20.         for(int j = 0; j < column; j++){
  21.             cout << arr[i][j] << " ";
  22.         }
  23.         cout << endl;
  24.     }
  25.    
  26.     return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement