MINIMUM AND MAXIMUM OF A LIST

/* Write a C program to find both the largest and smallest number in a list of integers*/

# include<stdio.h>
void main()
{
int a[100],n,k,i,j,MIN,MAX;
printf("Enter the number of elements you want to enter:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n Enter the value:");
scanf("%d",&a[i]);
}
MAX=a[0];
for(j=1;j<n;j++)
{

if(MAX<a[j])
MAX=a[j];
}
printf("Max: %d\n",MAX);

MIN=a[0];
for(k=1;k<n;k++)
{
if(MIN>a[k])
MIN=a[k];
}
printf("Min: %d",MIN);
}