Thursday, July 25, 2013

Program to access the elements in two dimensional array and display it


#include<iostream.h>
#include<conio.h>
void main()
{
 clrscr();
 int a[20][20],m,n,i,j;
 cout<<"Enter the size of matrix : "
 cin>>m>>n;
 cout<<"Enter the elements : ";
 for(i=0;i<m;i++)
 for(j=0;j<n;j++)
 cin>>a[i][j];
 cout<<"The matix is : "<<"\n";
 for(i=0;i<m;i++)
 {
 for(j=0;j<n;j++)
 {
 cout<<a[i][j]<<"\t";
 }
 }
 getch();
}

No comments:

Post a Comment