C program to display the odd digits present in integer

C program to display the odd digits present in integer

Odd number can not be divided by 2. The remainder after dividing an Odd number by 2 is one. For example . . . Odd digits of number 6547 are 5 and 7.

#include<stdio.h>

int main(){

int num,rem,odd=0,digit;

printf(”  Enter an integer number: “);

scanf(“%d”,&num);

printf(“\n  The Odd digits present in %d are \n”,num);

while(num>0){

digit = num % 10;

num = num / 10;

rem = digit % 2;

if(rem != 0)

printf(“\n  %d.”,digit);

}

return 0;

}