int isprime(int n){
int f =0;
for(int i = 2; i <= n/2; i++){
if(n%i == 0){
f=1;
break;
}
}
return f;
}
int find(int *a,int n){
int small=1000,c;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++){
c=a[i]*a[j];
if((i!=j)&&(!isprime©)&&(small>c)){
small=c;}
}
if(small==1000)
return -1;
else
return small;
}
int main(void) {
int t,n;
scanf("%d",&t);
while(t–>0){
scanf("%d",&n);
int *a =(int *) malloc (sizeof (int) * n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
int p =find(a,n);
printf("%d",p);
}
return 0;
}
i dont know why it is giving wrong answer
i checked in on dev …it is giving the right output