why am i getting wrong answer,yet it is right on my local machine??(the Smallest pair ,problem)

#include<stdio.h>
#include<stdlib.h>
int comp(const void *,const void *);

int main(){
int i=0,t=0,n=0,j=0;
long int arr[100];
// printf(“enter the noo of test cases”);
scanf("%d",&t);
for(i=0;i<t;i++){
//printf(“enter the value of n”);
scanf("%d",&n);
if(n>=2){
//printf(“enter the sequence”);
for(j=0;j<n;j++){
scanf("%ld",&arr[j]);
}

     qsort(arr,n,sizeof(int),comp);
     printf("%ld",(arr[0]+arr[1]));

     }
     }

return 0;
}

int comp(const void *i,const void *j){
return *(int *)i- *(int *)j ;
}

Your program is not printing new line . Also size of array is less . Here is your corrected


[1]


  [1]: http://www.codechef.com/viewsolution/4163844

your output should match with the output pattern specified. Like you’re printing “Enter the noo of test cases”. This will not match the output file pattern on codechef.

These lines are commented in the code .

//