i am trying to count total number of subarrays which are divisibleby a given number .

```
#include <iostream>
using namespace std;
int countsubarray(int array[], int n, int k)
{
int count = 0;
int i, j, mul;
for (i = 0; i < n; i++)
{
if (array[i]%k==0)
count++;
mul = array[i];
for (j = i + 1; j < n; j++)
{
mul = mul * array[j];
if (mul%k==0)
count++;
}
}
return count;
}
int main()
{
int n,k;
cin>>n>>k;
int array[n],i;
for(i=0;i<n;++i)
{
cin>>array[i];
}
int count = countsubarray(array, n, k);
cout << count << "\n";
}
```