The coding starts from next line:-
---------------------------------------------------------------------------------------------------------------
#include<iostream.h>
#include<conio.h>
void main()
{
int i,j,sum=0,a[3][3];
cout<<"\nEnter the Matrix of 3-3 size:\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<" "<<a[i][j];
}
cout<<"\n";
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if(i==j)
{
sum=sum+a[i][j];
}
}
}
cout<<"\n Sum is:"<<sum;
getch();
}