# Help me in solving BMCC166 problem

### My code

``````#include <stdio.h>

int main()
{
int t;
scanf("%d", &t);

while (t--)
{
int X;
scanf("%d", &X);

if (X % 10 == 0)
{
printf("\n0");
}
else
{
int found = 0;
for (int i = 1; i <= 5; i++)
{
if ((X * i) % 10 == 0)
{
printf("\n%d", i);
found = 1;
break;
}
}

if (!found)
{
printf("\n-1");
}
}
}
return 0;
}

``````

Learning course: Solve Programming problems using C
Problem Link: CodeChef: Practical coding for everyone

@nitheesha39
the logic is not right u can only multiply it with 2
so if the number is divisible by 5 then only one turn needed or else if the number is already divisible by 10 then 0 needed else print -1;

@dpcoder_007
I mistakenly overlooked the multiplication component.
Despite incorporating your suggested logic into my code, it is still producing an incorrect answer.

@nitheesha39

``````// Update the code below to solve the problem

#include <stdio.h>

int main()
{
int t;
scanf("%d",&t);

while(t--)
{
int X;
scanf("%d",&X);
if(X%10==0)
printf("0\n");
else if(X%5==0)
printf("1\n");
else
printf("-1\n");
}
}
``````