c语言中求数组的最小值和最大值
作者:互联网
#include <stdio.h> int main(void) { int a[7] = {45,32,86,56,24,98,85}; int min, max; min = a[0]; max = a[0]; int i; for (i = 0; i < 7; i ++) { if (a[i] < min) min = a[i]; if (a[i] > max) max = a[i]; } printf("min = %d\n", min); printf("max = %d\n", max); return 0; }
标签:24,min,int,max,最大值,中求,最小值,printf,main 来源: https://www.cnblogs.com/liujiaxin2018/p/14254635.html