URI online judge:1180 solution in C

https://www.urionlinejudge.com.br/judge/en/problems/view/1180

#include<stdio.h>
int main()
{
    int n, a[1000],min,i,pos=-1;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    min=a[0];
    for(i=1;i<n;i++){
        if(min>a[i]) {
                min = a[i];
                pos=i;
        }
    }
    printf("Menor valor: %d\n",min);
    printf("Posicao: %d\n",pos);
    return 0;
}

Comments