Problem 1737. The sum of individual numbers...
Well this one is taking a number and then summing the individual parts till you reach a value of 1, 2, 3, 4, 5, 6, 7, 8, 9, or 0 (only if the original is 0 the answer will be 0). For example:
x = [103]; So ---> 1+0+3 = 4 output = 4;
another example:
x = [99]; So ---> 9+9 = 18 ---> 1+8 = 9 output = 9;
another example:
x = [1199]; So ---> 1+1+9+9 = 20 ---> 2+0 = 2 output = 2;
another example:
x = [11 3]; So ---> 1+1 = 2 and 3 = 3 output = [2 3];
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers83
Suggested Problems
-
The Goldbach Conjecture, Part 2
2367 Solvers
-
Given an unsigned integer x, find the largest y by rearranging the bits in x
1859 Solvers
-
Similar Triangles - find the height of the tree
448 Solvers
-
Is this triangle right-angled?
5986 Solvers
-
Find out value of sine given by degree.
336 Solvers
More from this Author17
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!