function X = gauss0croix(A,B) 

n=size(A,'c')
if ~ size(A,'r')==n  then printf('matrice non carree'), end

A(:,n+1) = B // ou A=[A,B]
print(6,A),

nop=0,
for k = 1 : n/2 ,   // etape k
    if A(k,k)==0 then // recherche d'un pivot non nul
        printf('pivot nul a l''etape %d',k),
        if k<n then i=k+1,
                    while(A(i,k)==0 & i<n ), i=i+1, 
                    end,
               else i=k,
        end,
        if A(i,k)==0 then X='matrice singuliere', return 
                     else printf('on echange les lignes %d et %d',k,i),
                          A([k,i],:)=A([i,k],:),
                          print(6,A),
        end,
    end,
  
    printf('pivot=%f',A(k,k)),

    // for i = k+1 : n ,   // nouvelle ligne i
    //   A(i,k:n+1) = A(i,k:n+1) - A(i,k)*A(k,k:n+1)/A(k,k)
    // end,
    //// mieux
    i=n-k+1,
    printf("i=%d j=%d",k,i),
    A(i,[k,i,n+1])= A(i,[k,i,n+1]) - A(i,k)*A(k,[k,i,n+1])/A(k,k),
    nop =nop + 9,
    printf('etape %d',k),
    print(6,A),
end,
printf('descente en %d operations',nop),

// X(n) = A(n,n+1)/A(n,n),nop = nop+1 // remontee : calcul des xi
n2=int(n/2),
printf('n2=%d',n2),
for i=[n:-1:n2+1],
    X(i) =  A(i,n+1)/A(i,i), 
    nop=nop+1,
end
for i=[n2:-1:1],   
    X(i) = (A(i,n+1) - A(i,n-i+1)*X(n-i+1))/A(i,i),
    nop = nop + 3,
end,
printf('solution en %d operations',nop),



// -->for i=1:n, A(i,i)= int(rand(10)*10)+1; A(i,n-i+1)=int(rand(10)*10)+1;end,A
//  A  =

// !   9.    0.    0.    0.    0.    4. !
// !   0.    6.    0.    0.    4.    0. !
// !   0.    0.    5.    9.    0.    0. !
// !   0.    0.    8.    8.    0.    0. !
// !   0.    7.    0.    0.    3.    0. !
// !   4.    0.    0.    0.    0.    8. !

// -->for  i=1:n, B(i)=int(rand(10)*10)+1; end, B'
//  ans  =

// !   10.    3.    8.    4.    6.    2. !             

// -->gauss0croix(A,B)
                                                                                                                           