1 #include<stdio.h> 2 int main() { 3 4 int arr[5]; 5 printf(" please input five number :"); 6 for (int i = 0; i < 5; i++) { 7 scanf("%d", &arr[i]); 8 } 9 for (int i = 0; i < 5; i++) 10 { 11 printf("%d", arr[i]); 12 13 } 14 printf("\n"); 15 for (int i = 0; i < 4; i++) 16 { 17 for (int j = 0; j < 4 - i; j++) { 18 if (arr[j]>arr[j+1]) 19 { 20 int a = arr[j]; 21 arr[j] = arr[j+1]; 22 arr[j+1] = a; 23 } 24 } 25 26 } 27 for (int i = 0; i < 5; i++) 28 { 29 printf("%d", arr[i]); 30 31 } 32 return 0; 33 }
标签:arr,int,28,冒泡排序,++,printf From: https://www.cnblogs.com/tkmi/p/18076107