0
[SOLVED] Little confusion on while/ do while loop in C.
Here in my code, I tried to place the increment operator inside printf() to reduce the lines of code by removing the { braces. int i = 201; while(i <= 300) printf("%d\t", i, i++); And. i = 201; do printf("%d\t", i, i++); while(i <= 300); Is this a valid way to do and how does this work?
2 Respostas
+ 7
Try this printf("%d\t",i++); it will print current value and increment as your need
+ 9
Why don't you try it on your own on code playground to see wether it is valid or not👇
https://code.sololearn.com/cfIc95OkbhvM/?ref=app
{ Warnings are generated because you are passing more than required arguments to printf() frunction. To get rid of that use method suggested by Azhagesanヾ(˙❥˙) }