Cody

Problem 20. Summing digits

Solution 1882401

Submitted on 24 Jul 2019 by jinyu zhou
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))

m = 2 c = 0.3010 d = 1 g = 2 m = 0 b = 2

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

m = 1024 c = 3.0103 d = 4 g = 4 m = 102 g = 4 2 m = 10 g = 4 2 0 m = 1 g = 4 2 0 1 m = 0 b = 7

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

m = 65536 c = 4.8165 d = 5 g = 6 m = 6553 g = 6 3 m = 655 g = 6 3 5 m = 65 g = 6 3 5 5 m = 6 g = 6 3 5 5 6 m = 0 b = 25

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!