+ 2
Predict the output:
int a=0; while(a<=50) for( ; ;) if(++a%50==0) break; printf("a=%d", a) ;
1 Resposta
+ 15
100
Its obvious to say , that break will occur in for loop for 1st time when value of a becomes 50 ... but the condition for while loop is still true ,
then for loop will only get break ... when a%50 will get equal to 0 ... & 2nd time it will become possible for a=100 & after that while loop condition also becomes false
//hence , 100 will be the final value of a
//hope it helps 👍