Cody

# Problem 721. Convert from Base 10 to base 5

Solution 459780

Submitted on 21 Jun 2014 by rifat
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
%% x = 5; y_correct = 10; assert(isequal(cbase5(x),y_correct))

u = 0 0 0 1 0 2 0 3 0 4 1 0 1 1 1 2 1 3 1 4 2 0 2 1 2 2 2 3 2 4 3 0 3 1 3 2 3 3 3 4 4 0 4 1 4 2 4 3 4 4 u = 0 0 0 1 0 2 0 3 0 4 1 0 1 1 1 2 1 3 1 4 2 0 2 1 2 2 2 3 2 4 3 0 3 1 3 2 3 3 3 4 4 0 4 1 4 2 4 3 4 4 p = 1 0 ans = 10

2   Pass
%% x = 6; y_correct = 11; assert(isequal(cbase5(x),y_correct))

u = 0 0 0 1 0 2 0 3 0 4 1 0 1 1 1 2 1 3 1 4 2 0 2 1 2 2 2 3 2 4 3 0 3 1 3 2 3 3 3 4 4 0 4 1 4 2 4 3 4 4 u = 0 0 0 1 0 2 0 3 0 4 1 0 1 1 1 2 1 3 1 4 2 0 2 1 2 2 2 3 2 4 3 0 3 1 3 2 3 3 3 4 4 0 4 1 4 2 4 3 4 4 p = 1 1 ans = 11

3   Pass
%% x = 50; y_correct = 200; assert(isequal(cbase5(x),y_correct))

u = 0 0 0 0 0 1 0 0 2 0 0 3 0 0 4 0 1 0 0 1 1 0 1 2 0 1 3 0 1 4 0 2 0 0 2 1 0 2 2 0 2 3 0 2 4 0 3 0 0 3 1 0 3 2 0 3 3 0 3 4 0 4 0 0 4 1 0 4 2 0 4 3 0 4 4 1 0 0 1 0 1 1 0 2 1 0 3 1 0 4 1 1 0 1 1 1 1 1 2 1 1 3 1 1 4 1 2 0 1 2 1 1 2 2 1 2 3 1 2 4 1 3 0 1 3 1 1 3 2 1 3 3 1 3 4 1 4 0 1 4 1 1 4 2 1 4 3 1 4 4 2 0 0 2 0 1 2 0 2 2 0 3 2 0 4 2 1 0 2 1 1 2 1 2 2 1 3 2 1 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