#include <stdio.h>
void Insertionsort( double A[], int n ) {
    // sort A[0],A[1],...,A[n-1] into ascending order
       int i,m; double t;
       if( n<=1 ) return; // A is already sorted
       Insertionsort(A,n-1);
       t = A[n-1];
       for( i=n-2; i>=0 && A[i]>t; i-- )
          A[i+1] = A[i];
       A[i+1] = t;
    }


int main() {
    int n,i;
    double A[10];
    A[0] = 10; A[1] = 2; A[2] = 9; A[3] = 4; A[4] = 8; 
    A[5] = 1;  A[6] = 3; A[7] = 7; A[8] = 5; A[9] = 6;

    n = 10;
    Insertionsort(A,n);
    for( i=0; i<10; i++ ) printf("%f  ",A[i]);
    printf("\n");
    return 1;
}
