Find the sum of major diagonal of a 4x4 matrix

i need to write a program to find the major diagonal of a 4x4 matrix.
this is my code so far.
i cant get the result. please help and correct my code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

const int SIZE = 4;
const int ROW = 4;
const int COLUMN = 4;
double total;

void SUM(int array[][COLUMN], int rows)
{
for (int i=0; i<4; i++)
    {
        for (int j=0; j<SIZE; j++)
        {
            if (i == 0 && j == 0) {
                total += array[i][j];
            }
            else if ((i)/(j) == 1) 
            {
                total += array[i][j];
            }
        }
}
cout << total << endl;
}
int main()
{
	int total = 0;
	int L[ROW][COLUMN];
	cout << "input the matrix elements: ";
	for(int ROW = 0; ROW < 4;ROW++)
	for(int COLUMN = 0; COLUMN < 4;COLUMN++)
	cin >> L[ROW][COLUMN];
	SUM(L,ROW);

	return 0;
}
Topic archived. No new replies allowed.