题解 | #最高分与最低分之差#
最高分与最低分之差
https://www.nowcoder.com/practice/e0e4f81dcd55408a8973f8033bbeb1d2
#include <stdio.h> int main() { int n; scanf("%d",&n); int arr[n]; int max = 0 ,min = 100; for (int i = 0 ; i < n ; i++) { scanf("%d ",&arr[i]); if (arr[i] >= max) max = arr[i]; if (arr[i] <= min) min = arr[i]; } printf("%d\n",max-min); return 0; }