The result of the expression s++ is the value of s *before* the increment, so the expression (s++ < 10) operates on the values 0 through 9.
In the body of the loop, s has been incremented, so the expression (s < 4 && s < 9) operates on the values 1 through 10. When s is between 1 and 3, the continue statement is executed and the loop repeats from the beginning, skipping the printf. So only the values 4 through 10 are written to standard output.
Nits: unless your compiler documentation *explicitly* lists void main() as a legal signature, use int main(void) instead.
aswinipani
Sep 25th, 2011
ans is (3)- 4 5 6 7 8 9 10
Abhinav kumar
Sep 28th, 2011
The result of the expression s++ is the value of s *before* the increment, so the expression (s++ < 10) operates on the values 0 through 9.
Ans:3 s++ means-first s=0 then s=s+1.so checking the initial value of s & then increment the value of s.In this way continuing this process & print the value of s.
Output of the C program
1) 1 2 3 4 5 6 7 8 9
2) 1 2 3 10
3) 4 5 6 7 8 9 10
4) 4 5 6 7 8 9
Related Answered Questions
Related Open Questions