1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#include<iostream>
using namespace std;
int main()
{
int r1,r2,r3,r4,r5,r6,r7,r8,r9;
cout<<"enter the matrix elements ";
cin>>r1>>r2>>r3>>r4>>r5>>r6>>r7>>r8>>r9;
int matrix[3][3] = {
{r1,r2,r3},
{r4,r6,r8},
{r5,r7,r9}
};
int x,y;
for(y = 0; y < 3; ++y)
{
for(x = 0; x < 3; ++x)
cout << matrix[y][x];
cout << endl;
}
return 0;
}
|