PROGRAM TO ENTER A MATRIX AND PRINT USING C
#include<conio.h>
#include<iostream.h>
void main()
{
clrscr();
int a [10],i,j,n,m;
cout<<"enter raws
and columns:";
cin>>m>>n;
cout<<"enter the
matrix:\n";
for(i=0;i<m;i++)
for(j=0;j<n;j++)
cin>>a[i][j];
cout<<"the matrix is\n";
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
cout<<a[i][j]<<" ";
cout<<"\n";
}
getch();
}
OUTPUT:
Enter raws and columns :2
3
Enter the matrix:
4
5
6
9
8
7
The matrix is
4 5 6
9 8 7
No comments: