#include <stdio.h>

int main() {
    int a[10] = {9, 2, 4, 6, 5, 2, 1};
    int c = 7; // Number of elements in the array
    
    printf("%d\n", c);

    for (int i = 0; i < c; i++) {
        for (int j = 0; j < c - 1 - i; j++) {//imp
            if (a[j + 1] < a[j]) {
                int tmp = a[j];
                a[j] = a[j + 1];
                a[j + 1] = tmp;
            }
        }
    }

    for (int i = 0; i < c; i++) {
        printf("%d ", a[i]);
    }
    
    return 0;
}

Embed on website

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