LogiQuest
Back to Arrays
17

What will be the output of the program?

#include <stdio.h>

int main(void) {
    int m[2][3] = {{1, 2, 3}, {4, 5, 6}};
    int i, j, s = 0;
    for (i = 0; i < 2; i++) for (j = 0; j < 3; j++) if (i == 1) s += m[i][j];
    printf("%d\n", s);
    return 0;
}
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.