求最大最小整数.c 226 B

123456789101112131415
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n,i,num;
  5. int max=-1000000000,min=1000000000;
  6. scanf("%d",&n);
  7. for(i=0;i<n;i++){
  8. scanf("%d",&num);
  9. if(num>max)max=num;
  10. if(num<min)min=num;
  11. }
  12. printf("%d %d",max,min);
  13. return 0;
  14. }