Count Even Digits

Given a number the task is to find the number of even digits present in the number.

Example 1: Let us take a number 58162. Here number of even digits is 3.

Java
import java.util.*;
public class EvenDigitCount
{
    public static void main(String args[])
    {
        int n=0,r=0,count=0;
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter a number: ");
        n=sc.nextInt();
        while(n>0)
        {
            r=n%10;
            if(r%2==0)
            {
                count++;
            }
            n=n/10;
        }
        System.out.println("Number of even digits: "+count);
    }
}
Java