Bubble Sorting

PHOTO EMBED

Wed Mar 13 2024 02:35:09 GMT+0000 (Coordinated Universal Time)

Saved by @kervinandy123 #c

#include <stdio.h>

int main() {
    int x[5]={8, 10, 6, 2, 4};
    int temp, i, j;
    
    for(i=0; i<=4; i++)
        for(j=0; j<4; j++)
        
            if(x[j] > x[j+1])
            {
                temp=x[j];
                x[j]=x[j+1];
                x[j+1]= temp;
            }
    for(i=0; i<=4; i++)
    printf("%d   ", x[i]);
        

    return 0;
}
content_copyCOPY