function x = Simplex(C, A, b)
N = length(b);
B  = [A,  diag(ones(N,1)), b];
B = [B; C, zeros(1, N+1)]
M = length(B(1,:));


%while 1
for it = 1:10
    sprintf('iteracion  = %d\n', it)
    disp(B);
    [mm, m] = max(B(N+1,:)) ;
    [mn, n] = imin(B(1:N, M)./B(1:N, m));
    
    if mm == 0
        break;
    end;
      
    B(n,:) = B(n, :)./B(n,m);
    
    for k = 1: N+1
        if n ~= k
            B(k,:) = B(k,:) - B(n,:)*B(k,m);
        end;
    end; 
end;
x=B;