This is a beta version of Practice-It. Give us feedback

logo Practice-It logo

countEvenDigits

Language/Type: Java method basics mod parameters
Author: Marty Stepp (on 2018/05/01)

Write a method named countEvenDigits that accepts an integer parameter and returns the number of even digits in that integer. An even digit is one whose value is either 0, 2, 4, 6, or 8.

For example, the number 8546587 has four even digits (the two 8s, the 4, and the 6), so the call countEvenDigits(8346387) should return 4.

You may assume that the value passed to your method is greater than 0.

Type your solution here:


This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.