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.

C
#include <stdio.h>
int main()
{
    int n=0,r=0,count=0;
    printf("Enter a number: ");
    scanf("%d",&n);
    while(n>0)
    {
        r=n%10;
        if(r%2!=0)
        {
            count++;
        }
        n=n/10;
    }
    printf("Number of Odd digit: %d",count);
    return 0;
}
C