You have written a rather unhelpful for loop. y needs to increase as s decreases or anything mathematically equivalent.