# Help me in solving AOCV203 problem

### My issue

can anyone explain me this question, how they get output ??

### My code

``````// Update the '_' in the code below to solve the problem

#include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;

while(t--)
{
int N, K;
cin >> N >> K;
int A[N];
// Declare and initialise variables - pos, neg and divk
// Note that we are reinitializing the variables to be 0 for each test case.
int pos = 0;
int neg = 0;
int divk = 0;
for(int i = 0; ____; i++)
{
// Input the elements to the array
cin >> A[i];
}
for(int i = 0; i < N; i++)
{
// Count the negative elements of the array
if(__ _ 0)
{
neg = neg + 1;
}
// Count the positive elements of the array
else if(__ __ 0)
{
pos = pos + 1;
}
// Count if the given element is divisible by k
if (__ __ 0)
{
divk = divk + 1;
}
}
cout << pos <<" "<< neg <<" "<< divk << endl;
}
}
``````

Learning course: Beginner DSA in C++
Problem Link: CodeChef: Practical coding for everyone

@jayambe7
the logic is just iterate through the loop and count for the numbers <0 and numbers >0 and the number %k==0 .
and then return the counts.

``````plzz refer the following solution for better understanding.
``````

// Solution as follows

include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;

``````while(t--)
{
int N, K;
cin >> N >> K;
int A[N];
// Declare and initialise variables - pos, neg and divk
// Note that we are reinitializing the variables to be 0 for each test case.
int pos = 0;
int neg = 0;
int divk = 0;
for(int i = 0; i < N; i++)
{
// Input the elements to the array
cin >> A[i];
}
for(int i = 0; i < N; i++)
{
// Count the negative elements of the array
if(A[i] < 0)
{
neg = neg + 1;
}
// Count the positive elements of the array
else if(A[i] > 0)
{
pos = pos + 1;
}
// Count if the given element is divisible by k
if (A[i] % K == 0)
{
divk = divk + 1;
}
}
cout << pos <<" "<< neg <<" "<< divk << endl;
}
``````

}

thank you sir