Just go with the program hint given by Gauri this program
Code:
for(int i=0;i<3;i++)
{
for (int j=0;j<=i;j++)
{
if(i==j)
{
cout<<"the diagonal elements are"<<a[i][j];
}
}
}