Cody

# Problem 20. Summing digits

Solution 1445561

Submitted on 21 Feb 2018 by md.wahid tousif_rahman
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))

p = 2 a = 2 p = 0 b = 2 b = 2

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

p = 1024 a = 4.0000 p = 102 a = 4.0000 2.0000 p = 10 a = 4.0000 2.0000 0 p = 1 a = 4.0000 2.0000 0 1.0000 p = 0 b = 4.0000 b = 6.0000 b = 6.0000 b = 7.0000 b = 7

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

p = 65536 a = 6.0000 p = 6553 a = 6.0000 3.0000 p = 655 a = 6.0000 3.0000 5.0000 p = 65 a = 6.0000 3.0000 5.0000 5.0000 p = 6 a = 6.0000 3.0000 5.0000 5.0000 6.0000 p = 0 b = 6.0000 b = 9.0000 b = 14.0000 b = 19.0000 b = 25.0000 b = 25

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!