Cody

Problem 1510. Number of digits in an integer

Solution 2422419

Submitted on 30 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
x = 1; y_correct = 1; assert(isequal(HowManyDigits(x),y_correct))

count = 0 in = 0 count = 1 out = 1

2   Pass
x = 10; y_correct = 2; assert(isequal(HowManyDigits(x),y_correct))

count = 0 in = 1 count = 1 in = 0 count = 2 out = 2

3   Pass
x = 100; y_correct = 3; assert(isequal(HowManyDigits(x),y_correct))

count = 0 in = 10 count = 1 in = 1 count = 2 in = 0 count = 3 out = 3

4   Pass
x=1000; y_correct = 4; assert(isequal(HowManyDigits(x),y_correct))

count = 0 in = 100 count = 1 in = 10 count = 2 in = 1 count = 3 in = 0 count = 4 out = 4

5   Pass
x=5435742363271149; y_correct = 16; assert(isequal(HowManyDigits(x),y_correct))

count = 0 in = 5.4357e+14 count = 1 in = 5.4357e+13 count = 2 in = 5.4357e+12 count = 3 in = 5.4357e+11 count = 4 in = 5.4357e+10 count = 5 in = 5.4357e+09 count = 6 in = 543574236 count = 7 in = 54357423 count = 8 in = 5435742 count = 9 in = 543574 count = 10 in = 54357 count = 11 in = 5435 count = 12 in = 543 count = 13 in = 54 count = 14 in = 5 count = 15 in = 0 count = 16 out = 16

Suggested Problems

Community Treasure Hunt

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

Start Hunting!