i don't understand what is wrong with this answer for the question CIELAB.c

#include<stdio.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
int temp = a-b;
temp = temp/10;
int result = 0;
int power = 10;
int k;
while(temp)
{
k = temp%10;
result = result + kpower;
temp = temp/10;
power = power
10;
}
printf("%d\n",result);
return 0;
}

because if difference calculated is of 1 digit then your answer will print 0
while from explanation of test case it is clear that post zeros are not allowed…happy coding…

There are two problems with your soln…

#1) the zero problem mentioned by code_champ
so to solve that make you can make
temp=2;
#2) but this is not enough… what is it was already 2 ?? like 22-10=12
then soln is…

if((a-b)%10!=2) 
    temp=2;  
 else    
    temp=3;

try to print any digit rather than zero when difference of 1 digit came