DESCRIPTION-:This program display the elements of two dimensional array.means that it display elements of array in the form of matrix.
In this program we must specifies the number of rows and columns in the array.
PROGRAM-:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,m,n,a[100][100];
cout<<"enter number of rows and column in array"<<"\n";
cin>>m>>n;
cout<<"enter value of elements of array"<<"\n";
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>a[i][j];
}
}
cout<<"values of 2-D array element is"<<"\n";
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<"\t";
cout<<a[i][j];
}
cout<<"\n";
}
getch();
}
In this program we must specifies the number of rows and columns in the array.
PROGRAM-:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,m,n,a[100][100];
cout<<"enter number of rows and column in array"<<"\n";
cin>>m>>n;
cout<<"enter value of elements of array"<<"\n";
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>a[i][j];
}
}
cout<<"values of 2-D array element is"<<"\n";
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<"\t";
cout<<a[i][j];
}
cout<<"\n";
}
getch();
}
0 comments:
Post a Comment