Count Odd Digits

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

Example 1: Let us take a number 52831. Here the number of odd digits is 3.

Java
import java.util.*;
public class OddDigitCount
{
    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 odd digits: "+count);
    }
}
Java