look.
Code: Select all
while(gets(line))
u should not take input by gets. because
if any spaces occur ur output is wrong.check this input.
Code: Select all
112233
30800
2937
323455693
5038297
112234
Code: Select all
for(i=0;i<length;i++)
{
if(i%2==0)
sum=sum+line[i]-48;
else
sum1=sum1+line[i]-48;
}
if(sum>sum1)
dif=sum-sum1;
else
dif=sum1-sum;
Instead of it use Big Integer algorithm to solve it.
hope it helps.