← All examples

Symmetric matrix check

C++ Loops

nested loops

Flowchart (ISO 5807)

YesNoStartInput a[][10], ni = 0, n - 1, 1j = 0, n - 1, 1a[i][j] != a[j][i]Return falseEndReturn trueEndFigure 1 — isSymmetric

Source code

bool isSymmetric(int a[][10], int n) {
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i][j] != a[j][i]) {
                return false;
            }
        }
    }
    return true;
}