In this problem, a number will be given.
starting with the first digit, keep on adding all subsequent digits till the state (even or odd) of the sum of the digits is opposite to the state of the first digit.
Continue this way till the last digit of the number is reached.
Concatenate all the sums to generate the new number.
for example, n=74561. we start with 7(odd); 7+4==11(odd); 11+5=16(even); y=16 remaining 6(even); 6+1=7(odd); y=167
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers14
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15797 Solvers
-
Return unique values without sorting
1009 Solvers
-
Compute a dot product of two vectors x and y
1052 Solvers
-
Return the first and last characters of a character array
12159 Solvers
-
39 Solvers
More from this Author174
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!