#include <stdio.h> int main() { int c=50; for(;c;) c--; printf ("c=%d",c); return 0; } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

#include <stdio.h> int main() { int c=50; for(;c;) c--; printf ("c=%d",c); return 0; }

H

27th Dec 2020, 9:43 AM
Ankit Kumar
4 Answers
+ 8
Please make your question clear using relevant tags and what help you need please specify it clearly
27th Dec 2020, 9:59 AM
Aysha
Aysha - avatar
+ 6
Pls clarify your question, Pls add a code playground, so peope can help you simply, but clarify your question. Add relevant tags to the question too. Thank you.
27th Dec 2020, 9:59 AM
Matthew
Matthew - avatar
+ 3
c=0, because you decrease it in loop and when item become 0, loop finished!
27th Dec 2020, 10:07 AM
george
george - avatar
+ 2
According to your given information about this code , I found that here in output, c=0 Reason: because in your code you decremented the value of c . And when the value of c become 0 , then we came out of the loop. Hence , the value of c came as 0 in output.
27th Dec 2020, 3:06 PM
KRITI
KRITI - avatar