BUYING SWEET

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
int store,sum,result;
int main()
{
int T;
scanf("%d",&T);
for (int q=0;q<T;q++)
{

int N,x;
scanf("%d" ,&N);
scanf("%d" ,&x);
int note[100];
for(int i=0;i<N;i++)
{
scanf("%d",&note[i]);
}
for (int i=0;i<N;i++)
{sum+=note[i];}
result=sum%x;

for(int i=0;i<N;i++)

{
if(result==note[i])
{
store=result;
}
}
if(result==0)
{
printf("%d",sum/x);
}
else if(result==store)
{
printf("%d",-1);
}
else
{
printf("%d",sum/x);
}

}}

You have to print newline after every answer for each test case.

//