1. 程式人生 > >求十個整數中,最大的數值

求十個整數中,最大的數值

#include<stdio.h>
#include<stdlib.h>
int main(){
	int arr[10] = { 10, 20, 15, 18, 19, -1, 7, 4, 3, 0 };
	int max = arr[0];
	int i = 1;
	while (i <= 9){
		if (max < arr[i]){
			max = arr[i];
		}
		i += 1;
	}
	printf("max=%d\n", max);
	system("pause");
	return 0;
}