#include<stdio.h>
int main(){
int array[5]={23, 44, 1, 100, 78};
int a=sizeof(array)/sizeof(int);
for(int i =0;i<a-1;i++){
for(int j = i+1;j<a;j++){
if(array[i] > array[j]){
int max = array[i];
array[i] = array[j];
array[j] = max;
}
}
}
for(int i = 0; i < a; i++){
printf("array[%d]=%d\n",i, array[i]);
}
return 0;
} |
|