As per the question i think answer should be :

5 10 2 1 5 10 2 1.

But still it is giving wrong answer. Help appreciated

# Title of your commentAs per the question i think answer should be : 5 10 2 1 5 10 2 1. But still it is giving wrong answer. Help appreciated

**Sharma29**#1

**sahil-sehgal**#2

Well, because it is wrong. If you check it more carefully, there’s a catch. try writing itreations one by one on a paper.

just do a dry run and you will get it , for the 1st iteration , it was (4-0)%4 so it would give 0 since 4 is divisible by 4 and gives remainder 0 but then for other iterations 4-i part is less than 4 so remainder is 4-i itself only