#include <stdio.h>

int main()
{
    int arr[5]={10, 3, 15, 12, 1};
    int temp; //swap을 위해 선언 
    
    for(int i=0;i<5;i++){
        
        for(int j=0;j<4-i;j++){
        
            if(arr[j]>arr[j+1]){
            
                temp=arr[j];
                arr[j]=arr[j+1];
                arr[j+1]=temp; 
            }
        }
    }
    
    for(int i=0;i<5;i++)
        printf("%d ",arr[i]);    
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: