Cody

Solution 1980509

Submitted on 17 Oct 2019 by Harsh Patel
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
a = 1; b = 2; out = sumDigits(a); assert(isequal(out, b))

nnn = '2' g = '2' f = '2' e = 2 b = 2

2   Pass
a = 10; b = 7; out = sumDigits(a); assert(isequal(out, b))

nnn = '1024' g = '1' f = '1' g = '0' f = 2×2 char array '1 ' ' 0' g = '2' f = 3×3 char array '1 ' ' 0 ' ' 2' g = '4' f = 4×4 char array '1 ' ' 0 ' ' 2 ' ' 4' e = 1 0 2 4 b = 7

3   Pass
a = 16; b = 25; out = sumDigits(a); assert(isequal(out, b))

nnn = '65536' g = '6' f = '6' g = '5' f = 2×2 char array '6 ' ' 5' g = '5' f = 3×3 char array '6 ' ' 5 ' ' 5' g = '3' f = 4×4 char array '6 ' ' 5 ' ' 5 ' ' 3' g = '6' f = 5×5 char array '6 ' ' 5 ' ' 5 ' ' 3 ' ' 6' e = 6 5 5 3 6 b = 25

Suggested Problems

More from this Author95