Current location - Training Enrollment Network - Mathematics courses - Mathematical expressions in c language
Mathematical expressions in c language
for(k = 2; k & lt6,; K++, k++) outer loop twice when k=2 and k=4.

When k=2, j=2, 3, 4, 5s =14;

When k=4 and j = 4,5, then s is re-assigned to 1.

S= 1+4+5= 10 and then push out the loop.

The result is 10.

{ s = 1;

for(j = k; j & lt6; j++)s+= j;

} Because this is a compound statement, the value of s is re-assigned to 1 when looping again.