-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2darry.cpp
More file actions
42 lines (28 loc) · 722 Bytes
/
2darry.cpp
File metadata and controls
42 lines (28 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<bits/stdc++.h>
using namespace std;
int main(){
int arr[3][4];
cout<<"Enter the 2d array elements : ";
//col wise input
// for(int col = 0; col<4; col++){
// for(int row = 0; row<3; row++){
// cin>>arr[row][col];
// }
// cout<<endl;
// }
//row wise input
for(int row = 0; row<3; row++){
for(int col = 0; col<4; col++){
cin>>arr[row][col];
}
cout<<endl;
}
//printing the array elements
cout<<"The array elements are : "<<endl;
for(int row = 0; row<3; row++){
for(int col = 0; col<4; col++){
cout<<arr[row][col]<<" ";
}
cout<<endl;
}
}