Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have the problem: In MatLab, create a recursive function to print the digits of a number backwards. For example, given the number 752, it

I have the problem:

In MatLab, create a recursive function to print the digits of a number backwards. For example, given the number 752, it should print 2 then 5 then 7. Once you get that working, have it return an array, where each call to the recursive function adds another digit to the array, e.g. 2, 5, 7.

I have the recursive working to print the number out but not as an array. Any help would be great.

My Code:

function revNum = rev_Val(myInput) out=0; while myInput > 0 temp = mod(myInput,10); out = 10*out+temp; myInput = rev_Val((myInput-temp)/10); end revNum = out; end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago