Question: Write a recursive method called evenDigits that accepts an integer parameter and that returns the integer formed by removing the odd digits from it. For

Write a recursive method called evenDigits that accepts an integer parameter and that returns the integer formed by removing the odd digits from it. For example, evenDigits(8342116) returns 8426 and evenDigits (-34512) returns -42. If the number is 0 or has no even digits, such as 35159 or 7, return 0. Leading zeros in the result should be ignored.

Step by Step Solution

3.46 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public static int evenDigits int n ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Building Java Programs A Back to Basics Approach Questions!