#include<stdio.h> 

int main()

{
    int a[50],n,min,max,minpos,maxpos,i;

    printf("Enter n:");
    scanf("%d",&n);
    printf("Enter %d number into array\n",n);

    for(i=1; i<=n; i++)
    {
        scanf("%d",&a[i]);
    }
    min=a[1],minpos=1,max=a[1],maxpos=1;

    for(i=2; i<=n; i++)
    {   if(min>a[i])
        {   min=a[i];
            minpos=i;
        }

        if(max<a[i])
        {   max=a[i];
            maxpos=i;
        }
    }
    printf("min=%d at %d : max=%d at %d",min, minpos,max,maxpos);

 return 0;
}
     
           
Note: Need to be arranged in compiler after copied
   

 OutPut:

Enter n:5 Enter 5 number into array 8 3 5 2 7 min=2 at 4 : max=8 at 1