I dont’ think i’ll get the algorithm but there’s definitely a very simple pattern in there >>
The result is just a recurring series of 0-1-2-3 in the one’s digits place and after every four consecutive numbers you are adding ten to the result and after every power of four multiplying 10 to the result. So at four the result is 10 and at 16 its 100 and so on.
so maybe its this >>
if(x%4==0)
{
y=…?? I just cant get it, arrgh! >
}