#include <stdio.h> int main() { int n;//输入成绩个数 scanf("%d", &n); int i = 0;//输入数组 int arr[n];//C99 for (i=0; i<n; i++) { scanf("%d", &arr[i]); } int max = arr[0];//最大值 for (i=1; i<n; i++) { if (arr[i] > max) { max = arr[i]; } } int min = arr[0];//最小值 for (i=1; i<n; i++) { if (arr[i] < min) { min = arr[i]; } } int gap = max - min;//分数差 printf("%d\n", gap); return 0; }