I dont know why I got wrong answer. Can you help me?
#include <stdio.h>
#include <math.h>
int reversednum(int n)
{int i,j,a,d,b[5];
int c;
if (!n){return 0;}
b[0]=n/10000;
b[1]=(n%10000)/1000;
b[2]=(n%1000)/100;
b[3]=(n%100)/10;
b[4]=(n%10);
for (i=0;!b[i];i++){}
c=b[i];
for(a=1,j=i+1,d=1;j<5;j++,a++){
d=d*10;
c+=b[j]*d;
}
return c;
}
void reversedsum(int a,int b)
{int c,d,e;
c=reversednum(a)+reversednum(b);
printf("%d\n",reversednum(c));
}
int main()
{int n=0,s,s2,m;
scanf("%d",&m);
while (n<m) {
scanf("%d %d",&s,&s2);
reversedsum(s,s2);
n++;
}
return 0;
}
created
last reply
- 7
replies
- 1.1k
views
- 2
users
- 1
link