- #include<stdio.h>
- int main(){
- int arr[]={1,5,36,3,66,36};
- int n=sizeof(arr)/sizeof(int);
- int a=0;
- for ( int i=0; i<n-1; i++) {
- for (int j=0; j<n-1-i;j++ ) {
- if (arr[j]<arr[j+1]) {
- a=arr[j];
- arr[j]=arr[j+1];
- arr[j+1]=a;
- }
- }
- }
- for (int i=0; i<n; i++) {
- printf("%d,",arr);
- }
- printf("\n");
- return 0;
|
|