📜  排序数组 - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:38.954000             🧑  作者: Mango

代码示例2
#include 

int main()
{
    int ara[10]={4,45,23,53,2,64,56,34,77,98};
    int i,j,temp;
    for(i = 0; i < 10; i++){
        
        for(j = 0; j< 10; j++){
            if(ara[i] < ara[j]){ //use getter than (>) symbol for sorting from getter than to less than
                
                temp = ara[i];
                ara[i] = ara[j];
                ara[j] = temp;
                
            }
        }
        
    }
    
    for(i = 0; i < 10; i++){ //printing array sorted array elements
        
        printf("%d\t",ara[i]);
    }
    return 0;
}