Help me in solving LPYAS170 problem

My issue

ok so its showing runtime error… any help with this?

My code

#include <stdio.h>

int main() {
	// your code goes here
 int t;scanf("%d", &t);
 while(t>0)
 {
     int a[10];
     int i,j,n;
     scanf("%d",&n);
     
     for(i=0;i<n;i++)
     scanf("%d",&a[i]);
     
     for(i=0;i<2;i++)
     {
         for(j=0;j<n-i-1;j++)
         {
             if(a[j]>a[j+1])
             {
                 int temp=a[j];
                 a[j]= a[j+1];
                 a[j+1]= a[j];
             }
         }
     }
     printf("%d\n", a[0]);
     t--;
 }
}


Learning course: Algorithmic Problem Solving
Problem Link: https://www.codechef.com/learn/course/klu-problem-solving/KLUPS00A/problems/LPYAS170