# include & lt; stdio.h>
Void sum (int n)
{
Int sumn, t, I=0, num=1;
While (sumn! Num)={
Num=sumn;
Sumn=0;
While (n!=0) {
T=n;
T=t % 10;
N=n/10;
Sumn +=t;
}
Sumn=sumn * 3 + 1;
N=sumn;
I=I + 1;
Printf (" % d: % d \ n ", I, sumn);
}
}
Int main ()
{
int n;
The scanf (" % d ", & amp; N);
Getchar ();
The sum (n);
return 0;
}
CodePudding user response:
Where does the ptaI also do a do
Try to use your code
CodePudding user response:
Sorry, forgot to send the topic request,CodePudding user response:
CodePudding user response:
The firstYour sumn uninitialized, while the first execution (sumn!=sun) can be any value
The second
If the incoming n is 0, how will
CodePudding user response:
Oww, n=0, you already consideredSee sumn initial value
CodePudding user response:
Buy the original poster isI took half a day did not find
Should be sumn initialization, such as the pta is very high for this request
CodePudding user response:
The