#include<stdio.h>

int main(){
    int a[]={12,3,4,5,6};
    int l=sizeof(a)/sizeof(a[0]);
    printf("Size of array : %d",l);
    printf("\nBefore sorting \n");
    for(int i2 = 0;i2<l;i2++){
        printf("%d\t",a[i2]);
    }
    
    for(int i=0;i<l;i++){
        for(int j=i+1; j<l;j++){
            if(a[i]>a[j]){
                int temp=0;
                printf("\nBefore : a[i]= %d and a[j]=%d",a[i],a[j]);
                temp=a[i];
                a[i]=a[j];
                a[j]=temp;
                printf("\nAfter : a[i]= %d and a[j]=%d",a[i],a[j]);
            }
        }
    }
    printf("\nNew array ");
    for(int i3 = 0;i3<l;i3++){
        printf("%d\t",a[i3]);
    }
    
    return 0;
}

Embed on website

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