数字反转
#include <iostream>
using namespace std;
int reverse(int n)
{
int res=0;
while(n>0)
{
res=n%10+res*10;
n /=10;
}
return res;
}
int main()
{
int x,y;
while(cin>>x>>y)
{
int res1;
res1=reverse(x)+reverse(y);
if(res1==reverse(x+y))
{
cout<<x+y<<endl;
}
else
&n...
登录后发布评论
建议用代码插件,高亮语法显示,更容易阅读