#include <iostream.h>
#include <conio.h>
void main()
{
int mat[10][10], n;
cout<< "\n Enter dimension of the square matrix :";
cin>> n;
/* .. Input Matrix ..*/
for(int i =0 ; i< n ; i++ )
for ( int j = 0 ; j< n ; j++)
{
cout<< "\n Enter an element for position " << i+1 << " , " << j+1 << ": " ;
cin >> mat[i][j];
}
for( i =0 ; i< n ; i++ )
for ( j = 0 ; j< n ; j++)
mat[i][j] = 2* mat[i][j];
cout<<"\n The original matrix :";
for( i =0 ; i< n ; i++ )
{
for( j = 0 ; j< n ; j++)
cout<< mat[i][j] << " ";
cout << "\n";
}
cout<<"\n The Output Matrix : "
for(i =0 ; i< n ; i++ )
{for(j=0; j< n ; j++)
cout<< mat[i][j] << " ";
cout<< "\n" ;
}
getch();
}
No comments:
Post a Comment