**When i=4 , j=1 , switch (4+1-1)=4, ( case 4: ) what will be the right output? **
/* When i=4 , j=1 , switch (4+1-1)=4, ( case 4: ) which is not present on the code. So now it should go to default: (5+3)=8 But on the output I am getting 7 instead of 8 why? Can you please explain it? */ #include <stdio.h> main() { int i, j, x = 0; for (i = 0; i < 5; ++i) for (j = 0; j < i; ++j) { switch (i + j - 1) { case -1: case 0: x += 1; break; case 1: case 2: case 3: x += 2; break; default: x += 3; break; } printf("%d\n", x); } printf("\nx = %d", x); } Output: 1 3 5 7 9 12 14 17 20 23 x = 23Press any key to continue . . . */ https://code.sololearn.com/cYMktBgOzJ6h/?ref=app