Program to Find Largest and Smallest numbers using Arrays

# include <stdio.h>
#include<conio.h>
main ()
{
int a[10],i,big,small,n;
printf (“enter the size of the array”);
scanf (“%d, & n);
printf (“enter elements in an array”);
for ( i = 0; i < n ; i ++)
scanf ( “%d”, & a [i];
big = a[0];
small = a[0];
for ( i = 0; i < n ; i ++)
{
if (big < a [i])
big = a[i];
if (small > a [i])
small = a[i];
}
printf (“biggest number is %d \n smallest number is %d”, big, small);
getch();

}

Related

C Programs 2508940572349502619

Post a Comment

emo-but-icon

item