程序代码:
#include <stdio.h>
int main()
{
int arr[7] = {2,3,1,5,4,7,6};
int max,min;
max = arr[0];
min = arr[0];
for(int i = 1; i < 7; i++)
{
if(max < arr[i])
{
max = arr[i];
}
if(min > arr[i])
{
min = arr[i];
}
}
printf("max is : %d min is : %d\r\n",max,min);
return 0;
}