【C++】整数拆分程序框架

int n,y;
cout<<"Enter the number:";
cin>>n;//n保存输入的整数 
cout<<"The number in reverse order is";
while(n!=0)
{
 y=n%10;//对n求模取出当前个位数
 cout<<y;
 n=n/10;//即n=n/10运算,相当于对n右移一位,去掉已取出的个位数 
 } 
发布了19 篇原创文章 · 获赞 0 · 访问量 222

猜你喜欢

转载自blog.csdn.net/weixin_44825297/article/details/104961987