题解 | #求最大最小数#
求最大最小数
https://www.nowcoder.com/practice/82e5ff335eeb486aab359767895cc7b4
#include <stdio.h> int main() { int n; while (scanf("%d",&n) != EOF) { int max,min; int a[n]; scanf("%d",&a[0]); max=a[0]; min=a[0]; for (int i=1; i<n; i++) { scanf("%d",&a[i]); if(a[i]>max){ max=a[i]; }else if (a[i]<min) { min=a[i]; } } printf("%d %d\n",max,min); } return 0; }