Search This Blog

Thursday, 20 August 2020

2 d array in cpp

#include<iostream>

#define size 16

using namespace std;

int main()

{

int m,n;

int a[size][size];

cout<<"enter the no of rows and columns"<<endl;

cin>>m>>n;

cout<<"enter the elements in table"<<endl;

for(int i=0;i<m;i++)

{

for(int j=0;j<n;j++)

{

cin>>a[i][j];

}

}

                                                        //output of each array elements value 

for(int i=0;i<m;i++)

for( int j=0;j<n;j++)

{

cout<<"a["<<i<<"]["<<j<<"]:";

cout<<a[i][j]<<endl;

}                                                        

}


No comments:

Post a Comment

Search This Blog

Contact Form

Name

Email *

Message *

Popular Posts