#include <iostream>
using namespace std;
int main()
{
system("cls");
int m,n;
int ar[m][n];
cout<<"Enter the rows: "<<endl;
cin>>m;
cout<<"Enter the columns: "<<endl;
cin>>n;
cout<<m<<"x"<<n<<" Matrix"<<endl;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>ar[i][j];
}
cout<<endl;
}
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cout<<ar[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
Output:
Enter the rows:
2
Enter the columns:
2
2x2 Matrix
1 2
3 4
MAtrix:
3 4
3 4
It is only displaying the second row two times. i typed the program from again 2-3 times but no change how to overcome this error?
Please help me?