Social Icons

Sunday, 16 February 2014

Program to read a matrix display on the screen

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();         //to clear the screen
int a[5][5],n,m,i,j;
cout<<"\n Enter value of Row and Column : ";
cin>>m>>n;
cout<<"\n Enter elements of the matrix\n";

for(i=0;i<m;++i)
for(j=0;j<n;++j)
cin>>a[i][j];
cout<<"\n The Matrix is\n";
for(i=0;i<m;++i)
{
cout<<" ";
for(j=0;j<n;++j)
cout<<a[i][j]<<"  ";
cout<<"\n";
}
getch();         //to stop the screen
}


                                                                 Output

                                  

No comments:

Post a Comment