% Program to transform decimal numbers into equivalent numbers % in other bases. % conversion to new base Int=input('integer='); Base=input('Base='); i=1; while Int>0 % Computing the remainder of the division of Int by Base. aux1=Int/Base; Quotient=floor(aux1); Remainder(i)=Int-Base*Quotient; % The previous quotient is used as the starting number to % compute the next digit (to the left) Int=Quotient; i=i+1; end % Writing the digits in the right order to express the % equivalent new base number. fprintf('\n New Base=%2.0f\n ',Base); fprintf('Rerpresentation in this base='); for j=i-1:-1:1 fprintf('%1.0f',Remainder(j)); end