#include<stdio.h>//header file
#include<conio.h>//header file
void main() //starting of the main() function
{
int i,a[10],l,min,max; //declaration of the variables
clrscr();
printf("program that gives min. and max value of a list in single traversal");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter the length of the list");//taking input from the user
scanf("%d",&l);
printf("\nenter the elements in the list");
for(i=0;i<l;i++)
scanf("%d",&a[i]);
min=max=a[0];
for(i=1;i<l;i++)
{
if(a[i]>max)
max=a[i];
if(a[i]<min)
min=a[i];
}
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe max. and min. value after a single traversal is=%d %d",max,min);//printing
output
getch();
}