//http://www.spoj.com/submit/ADDREV/id=10772893
//mayur shingote
#include<stdio.h>
long int rev(long int n)
{
long int a[20]={0},i=0,m,sum=0;
while(n)
{
a[i++]=n%10;
n/=10;
}
m=1;
while(i--)
{
sum+=a[i]*m;
m*=10;
}
return sum;
}
int main()
{
long int test,no1,no2,result;
scanf("%ld",&test);
while(test--)
{
scanf("%ld%ld",&no1,&no2);
result=rev(no1)+rev(no2);
printf("%ld\n",rev(result));
}
return 0;
}
//mayur shingote
#include<stdio.h>
long int rev(long int n)
{
long int a[20]={0},i=0,m,sum=0;
while(n)
{
a[i++]=n%10;
n/=10;
}
m=1;
while(i--)
{
sum+=a[i]*m;
m*=10;
}
return sum;
}
int main()
{
long int test,no1,no2,result;
scanf("%ld",&test);
while(test--)
{
scanf("%ld%ld",&no1,&no2);
result=rev(no1)+rev(no2);
printf("%ld\n",rev(result));
}
return 0;
}
No comments:
Post a Comment