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