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; }