#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
int i = 0,j = 0,max = 0,min = 0,temp;// 用 temp 存放第一个随机数,i来存放//剩下的19 个随机数。
temp = arc4random() % (100 - 10 + 1) + 10;
int b = temp; // 为使下面重置时不冲突
printf("%d",temp);
for (j = 0 ; j < 19 ; j++) {
i = arc4random() % (100 - 10 + 1) + 10;
printf(" %d ",i);
max = i > temp ? i : temp;
temp = max; //重置 temp 值
min = i < b ? i : b;
b = min; // 重置 b值
}
printf("最大值是:%d 最小值是: %d",max,min);
return 0;
}