Question: Write a method oddDigits that accepts an integer parameter n and that returns the integer formed by removing the even digits from n. If there
Write a method oddDigits that accepts an integer parameter n and that returns the integer formed by removing the even digits from n. If there are no odd digit in the n, then return 1. The following table shows several calls and their expected return values:
Call Returned Value
oddDigits(20) 1
oddDigits(203) 3
oddDigits(139201) 1391
method header:
public int oddDigits(int n)
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
