Write a program, that takes 16-Elements in Two-Dimensional-Array that has 4 rows & 4 columns, then display the diagonal of Matrix.
#include<iostream>
using namespace std;
int main()
{
int arr[4][4],i,j;
cout<<"Enter elements of array: "<<endl;
for(i=0; i<4; i++)
{
for(j=0; j<4; j++)
{
cin>>arr[i][j];
}
}
cout<<"Daignal elements are :"<<endl;
for(i=0; i<4; i++)
{
for(j=0; j<4; j++)
{
if(i==j)
cout<<arr[i][j]<<"\t";
}
}
}