//program
to find the highest and smallest element within an array

void main()

{

int a[5],i,j,k;

clrscr();

printf("Enter
5 element of an array ");

for(i=0;i<5;i++)

scanf("%d",&a[i]);

j=k=a[0];

for(i=0;i<=4;i++)

{

if(a[i]>j)

{

j=a[i];

}

else
if(a[i]<k)

{

k=a[i];

}

}

printf("%d
is largest and %d is the smallest number of the array",j,k);

getch();

}

**Output**

Enter 5 element
of an array 27 3 28 92 24

92 is largest
and 3 is the smallest number of the array

## No comments:

## Post a Comment