ADDING REVERSED NUMBERS SPOJ SOLUTION

*/ "ADDREV" SPOJ SOLUTION */
#include<bits/stdc++.h>
using namespace std;
int rev(int x)
{
 int y=0,z;
 while(x>=1)
 {
 z=x%10;
 y=y*10+z;
 x/=10;
}
return (y);
}
int main()
{int t;
cin>>t;
while(t--)
{
int x,y,z;
cin>>x>>y;
z=rev(x)+rev(y);
cout<<rev(z)<<"\n";
}
return 0;
}

Comments

Popular posts from this blog

TDPRIMES SPOJ SOLUTION

Spoj CLOPPAIR Solution