I have just replaced following linestry entering in data that does not have the smallest or largest as the first or last input value.
Code:
{
if (largest< array[i])
largest = array[i];
else if( smallest > array[i] )
smallest = array[i];
}
size of the array
: 6
Enter elements of the array 6
: 4
5
6
7
1
2
largest element in array is 7
smallest element in array is 1

