logo CodeStepByStep logo

EvenDigits

Language/Type: C# recursion return

Write a recursive method named EvenDigits that accepts an integer parameter n and returns a new integer containing only the even digits from n, in the same order. If n does not contain any even digits, return 0.

For example, the call of EvenDigits(8342116) should return 8426 and the call of EvenDigits(35179) should return 0.

Method: Write a C# method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.