Adding Reversed Numbers Spoj Solutions
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
long long int n,m,rev=0,rev1=0,n1,m1,s=0,r;
cin>>n>>m;
n1=n;m1=m;
while(n>0){
rev=rev*10+n%10;
n/=10;
}
while(m>0){
rev1=rev1*10+m%10;
m/=10;
}
s=rev+rev1;
long long int srev=0;
while(s>0){
srev=srev*10+s%10;
s/=10;
}
cout<<srev<<endl;
}
return 0;
}
๐๐๐๐๐๐
If you have any doubts comment below๐
Comments
Post a Comment