Как получить самое низкое число на массиве в c
int main (void)
{
int temp, size;
//setting the array
int array[] = {10, 20, 25, 63, 96, 57};
size = array.length;
/*user input array
int array[];
for (int i = 0; i < 5; ++i)
{
cin >> array[i];
}
*/
for(int i = 0; i<size; i++ )
{
for(int j = i+1; j<size; j++)
{
if(array[i]>array[j])
{
//making a temp array
temp = array[i];
//passing the array
array[i] = array[j];
array[j] = temp;
}
}
}
//printing the lowest array which is located at array[0]
System.out.println("Smallest element of the array is:: "+array[0]);
//printing the highest array is located at the last value of the array -1
System.out.println("Smallest element of the array is:: "+array[size - 1]);
}
Alejandro Ferrazzini