Cody

Problem 45246. Count digits

Solution 2142361

Submitted on 27 Feb 2020 by Athi
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
n = 13; y_correct = 17; assert(isequal(count_dig(n),y_correct))

2   Pass
n = 1339; y_correct = 4249; assert(isequal(count_dig(n),y_correct))

3   Pass
n = 0; y_correct = 0; assert(isequal(count_dig(n),y_correct))

4   Pass
n = 299; y_correct = 789; assert(isequal(count_dig(n),y_correct))

5   Pass
n = 10000; y_correct = 38894; assert(isequal(count_dig(n),y_correct)) % n=10000675820025; y_correct = 128898350369253; assert(isequal(count_dig(n),y_correct))

Suggested Problems

More from this Author149

Community Treasure Hunt

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

Start Hunting!