Problem Link: http://www.spoj.com/problems/ADDREV/
#include<iostream>
using namespace std;
int reverse(int n){
int r=0;
while (n != 0)
{
r = r * 10;
r= r + n%10;
n = n/10;
}
return r;
}
int main()
{
int n;
cin>>n;
while(n--){
int a,b;
cin>>a>>b;
a=reverse(a);
b=reverse(b);
cout<<reverse(a+b)<<"\n";
}
return 0;
}
#include<iostream>
using namespace std;
int reverse(int n){
int r=0;
while (n != 0)
{
r = r * 10;
r= r + n%10;
n = n/10;
}
return r;
}
int main()
{
int n;
cin>>n;
while(n--){
int a,b;
cin>>a>>b;
a=reverse(a);
b=reverse(b);
cout<<reverse(a+b)<<"\n";
}
return 0;
}