Problem 45497. Four digit number ABCD reversal
write a MATLAB function to find the four-digit number ABCD when multiplied by 4 returns DCBA. The function takes an input x=4.
Solution Stats
Problem Comments
-
1 Comment
Michael
on 7 May 2020
You really shouldn't give away the answer in the test suite. ;-)
You could change the test suite to something like:
assert (str2num(fliplr(num2str(y))) == y*4);
Although this also sort of gives away one possible solution.
Solution Comments
Show commentsProblem Recent Solvers45
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15364 Solvers
-
356 Solvers
-
Reverse the elements of an array
987 Solvers
-
Relative ratio of "1" in binary number
1281 Solvers
-
Replace odd number in given matrix by zero
140 Solvers
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!