Geht auch einfacher:

Code:
for(i=0; i<(abs(x-y)); i++)
askazo