标签:style blog io color os sp for 数据 div
1 #include <stdio.h> 2 3 int main(){ 4 int n; 5 int number[101]; 6 int i; 7 int min; 8 int flag; 9 int temp; 10 11 while(1){ 12 scanf("%d",&n); 13 14 if(n==0) 15 break; 16 17 for(i=0;i<n;i++) 18 scanf("%d",&number[i]); 19 20 flag=0; 21 min=number[0]; 22 23 for(i=0;i<n;i++){ 24 if(number[i]<min){ 25 min=number[i]; 26 flag=i; 27 } 28 } 29 30 temp=number[0]; 31 number[0]=number[flag]; 32 number[flag]=temp; 33 34 for(i=0;i<n;i++){ 35 if(i!=0) 36 printf(" "); 37 38 printf("%d",number[i]); 39 } 40 printf("\n"); 41 } 42 return 0; 43 }
标签:style blog io color os sp for 数据 div
原文地址:http://www.cnblogs.com/zqxLonely/p/4098168.html