//对while语句进行流程分析
//假设用户输入数字121,判断是否回文数,m非0是真,否则为假,为真输出YES,假输出No;
1--->sum = sum*10+m%10 (sum = 0*10+121%10)//sum=0+1,sum=1
m / = 10(m=m/10)//m=121/10,m=12
2--->sum = sum*10+m%10(sum=1*10+12%10)//sum=10+2,sum=12
m / 10 =10(m=m/10) //m=12/10,m=1
3--->sum = sum*10+m%10(sum=12*10+1%10)//sum=120+1,sum=121
m / 10 =10(m=m/10) //m=1/10,m=0
m = 0为假,则输出No
新闻热点
疑难解答
图片精选