Divisible subarrays wrong answer

my code:

When I am trying to pass the test case :

2
5
1 1 1 1 1
5
2 2 2 2 2

it gives me the wrong output of

1
1

Can anyone help me what is the wrong here ?