I need to calculate the sum of two diagonals in a matrix in C++, I already have a solution for that but I must be dumb because I cant understand what it is doing, so I would
int num[5][5]={0}; //decleration int i=0,j=0,sum=0; for (int i=0;i<5;i++) { for (int j=0;j<5;j++) { cin>>num[i][j]; } //Taking Matrix input } cout<