Cody

Problem 44287. sum all digits

Solution 3283238

Submitted on 19 Oct 2020
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 = 1; y_correct = 1; assert(isequal(sum_all_digits(x),y_correct))

2   Fail
x = 112; y_correct = 4; assert(isequal(sum_all_digits(x),y_correct))

Assertion failed.

3   Fail
x = 18547; y_correct = 25; assert(isequal(sum_all_digits(x),y_correct))

Assertion failed.

4   Fail
x = 147852369; y_correct = 45; assert(isequal(sum_all_digits(x),y_correct))

Assertion failed.

5   Fail
x = 753159; y_correct = 30; assert(isequal(sum_all_digits(x),y_correct))

Assertion failed.

6   Fail
x = 1000245879653254; y_correct = 61; assert(isequal(sum_all_digits(x),y_correct))

Assertion failed.

Suggested Problems

More from this Author4

Community Treasure Hunt

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

Start Hunting!