#include <stdio.h>

int main() {
    int arr[5] = {7, 4, 2, 3, 1};
    for (int i = 1; i < 5; i++) {
        int k = arr[i];
        int j = i - 1;
        while (j >= 0 && k < arr[j]) {
            arr[j + 1] = arr[j];
            j--;
        }
        arr[j + 1] = k;
    }
    for (int i = 0; i < 5; i++) {
        printf("%d ", arr[i]);
    }
}

Embed on website

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