Seeking a maximum number of 10

#include<stdio.h>
#include<stdio.h>
int main(){
	int i[10] = { 3, 6, 1, 4, 5, 9, 1, 2, 6, 7 };
	int max = i[0];
	int j;
	for (j = 1; j < 10; j++){
		if (max < i[j])
			max = i[j];
	}
	printf("max=%d\n", max);
	system("pause");
}

The value of i [0] is assigned to max, the use of the for loop, the i [. 1] to i [. 9] sequentially compared worthwhile max, the determination by the if statement, the value assigned to large max, so you can find the maximum number of 10.

Guess you like

Origin blog.csdn.net/sun_105/article/details/92393359