Kindly help to solve this task on getting the last digit of a string.
3 views (last 30 days)
Show older comments
How would you call this function in command window
If radius is equal last digit of your roll number, what is the result?
rollnumber=5612
Answers (2)
Image Analyst
on 18 Apr 2022
Here is one way (of many):
rollnumber=5612;
str = num2str(rollnumber)
radius = str2double(str(end))
0 Comments
Star Strider
on 18 Apr 2022
Another approach —
rollnumber=5612
lastDigit = rem(rollnumber, 10)
.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!