ciel snd A-B

I have written this code in ciel and A-B output is right but it say wrong answer help
#include<stdio.h>
int main()
{
int a,b,c,d[10],i=0;
scanf("%d%d",&a,&b);
c=a-b;

while(c!=0)
{
d[i]=c%10;
c=c/10;
i=i+1;
}
d[i-1]=1;
for(int j=i-1;j>=0;j–)
{
printf("%d",d[j]);
}
return 0;
}

You just changed the most significant digit i.e the left most digit to 1 …
But what if it was already one ??
For example 43-31 = 12 now u did d[i-1]=1 (which was already one)
So u didn’t even changed the number
Hence replace
d[i-1]=1;

in your code with,

if(d[i-1]!=1) d[i-1]=1; else d[i-1]=2;

And you are ready to go…