Write a Java program that will prompt the user for an integer.
The program will determine how many digit of that integer are odd.
The numbers 0, 2, 4, 6, and 8 are even digits, and 1, 3, 5, 7, 9 are odd digits.
You may not use a String to solve this problem, else receive zero credit for this assignment.
Use the modulo operator % to get the rightmost digit, and / to discard the rightmost digit.
A loop should be used in order to get from step 8 to step 3 in the roadmap.
After prompting the user and reading an integer from the keyboard, your program must:
1. Name the number from the user input.
2. Declare and initialize a counter variable to zero.
3. Save the right-most digit of input in a variable using the modulo operator: rightMost = input % 10
4. Update the value of input = input / 10
5. Determine if the rightMost digit is odd. Use a divisibility test using the modulo operator %.
6. if rightMost is odd, increase the counter by 1.
7. if rightMost is even, do nothing.
8. if input is not zero, go to step 3.
9. if input is zero, the program has reached the last digit and it needs to go to step 10.
10. Display the results. counter will have the value of the number of odd digits in the original number.
* Your Java program should ask for and input the integer value to perform the operations on. Here are three sample runs:
Please enter an integer: 4822116
Number of odd digits: 2
Please enter an integer: 2448
Number of odd digits: 0
Please enter an integer: -7004
Number of odd digits: 1