Home > Back-end >  Want to ask some questions of the for loop
Want to ask some questions of the for loop

Time:03-16

This is digital traversal of a program, I would like to ask a for loop in the middle of the statement I is what meaning, is how to determine the end of the
#include
Int main ()
{
int n;
int i;
int tmp;
int sum=0;
Printf (" input a number: \ n ");
The scanf (" % d ", & amp; N);
For (I=n; i; I/=10)
{
Printf (" % d \ n ", I % 10);
}
return 0;
}

CodePudding user response:

Forget to delete the middle variables, only see n, I will do

CodePudding user response:

Intermediate I, said I==0 exit for loop,

CodePudding user response:

refer to the second floor ctrigger response:
middle, I said I==0 exit for loop,

Oh oh oh see thank you

CodePudding user response:

The for loop structure: the for (initialize variables; End conditions; Each operation)
(specific noun forget)
So every time I/=10 divided by 10, is the I in the middle of a logic operation, quit when I==0
  • Related