# End Of File 使用C++輸入及判定終止條件 ``` //片段程式碼 while(scanf("%d",&n)!= EOF ){ length=1; while(1){ if(n==1){ printf("%d\n",length); break; } else if(n%2==1){ n=(3*n)+1; # length++; } else{ n=n/2; length++; } } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up