Cody

Problem 2876. Convert number from given base to other base

Solution 566918

Submitted on 27 Jan 2015 by George Berken
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% n = 400; b=5; rb=8; y_correct = 144; assert(isequal(base_base(n,b,rb),y_correct))

a1 = 400 a2 = 100 a3 = 144 a4 = 144

2   Pass
%% n = 200; b=8; rb=5; y_correct = 1003; assert(isequal(base_base(n,b,rb),y_correct))

a1 = 200 a2 = 128 a3 = 1003 a4 = 1003

3   Pass
%% n = 125; b=6; rb=7; y_correct = 104; assert(isequal(base_base(n,b,rb),y_correct))

a1 = 125 a2 = 53 a3 = 104 a4 = 104

4   Pass
%% n = 143; b=8; rb=4; y_correct = 1203; assert(isequal(base_base(n,b,rb),y_correct))

a1 = 143 a2 = 99 a3 = 1203 a4 = 1203