Cody

Problem 20. Summing digits

Solution 2387218

Submitted on 27 May 2020 by Ramesh Kumar V
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))

a = 2 sum = 0 m = 2 sum = 2 a = 0

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

a = 1024 sum = 0 m = 4 sum = 4 a = 102 m = 2 sum = 6 a = 10 m = 0 sum = 6 a = 1 m = 1 sum = 7 a = 0

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

a = 65536 sum = 0 m = 6 sum = 6 a = 6553 m = 3 sum = 9 a = 655 m = 5 sum = 14 a = 65 m = 5 sum = 19 a = 6 m = 6 sum = 25 a = 0

Suggested Problems

More from this Author95

Community Treasure Hunt

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

Start Hunting!