您的位置:首页 > 编程语言

Windows平台下GCC编程之反向输出整数

2016-04-15 16:57 537 查看
Code::Blocks 16.01 + GCC 4.9.2 for Windows 编译运行成功
/*

9.编写一个程序,输入一个3位数的正整数,然后反向输出对应的数。如:123,则输出321。

*/

#include<iostream>

using namespace std;

int main()
{
int n;
int a,b,c;
cout<<"请输入3位整数:"<<endl;
cin>>n;
a=n/100;
b=(n-a*100)/10;                                 //Deteriorator
c=(n-a*100-b*10)/1;
cout<<c<<b<<a<<endl;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c++ gcc 编程