Question: Requirements: Use static method Can't allow using Break Create a small program that asks the user for an integer and then outputs the number of
Requirements:
- Use static method
- Can't allow using Break
Create a small program that asks the user for an integer and then outputs the number of odd digits it contains. For example with the value 23,475, the result would be that the value contain 3 odd digits. Your program should use a static method that is sent the integer as an input parameter and returns an integer that is the result. Note: return does not mean output. The method should return an integer; any input/output statements will be done in the main. If you are not creating a method, you will not get any credit for this problem. Inside the main you should also have a loop that allows you to repeat the query until 0 is given as the input. Hints: To remove a digit from the original number, we only need to integer divide it by 10. To determine if it is odd, we would find that there is a remainder if attempting to dividing it by 2.
Step by Step Solution
3.47 Rating (157 Votes )
There are 3 Steps involved in it
mainpy 1 def countodddigitsnum 0 23 3 4 LO 5 count while num ... View full answer
Get step-by-step solutions from verified subject matter experts
