Obviously, It will output 31.
Coz,
1st iteration in while loop =>
num is 1234
digit = num % 10;
digit = 1234 % 10 ( It's 4)
if(digit % 2 != 0)
{
printf("%d" , digit);
}
4 will not print coz 4 % 2 != 0
will return false.
num /= 10;
num = 1234 / 10 ( num is now 123)
2nd iteration in while loop =>
num is 123
digit = num % 10;
digit = 123 % 10 ( It's 3)
if(digit % 2 != 0)
{
printf("%d" , digit);
}
3 will be printed coz 4 % 2 != 0
will return true.
num /= 10;
num = 123 / 10 ( num is now 12)
So ... we got our first number 3.
So, if you continue this process (it's called debugging ) for the next while loop iterations you will find the final output ... that's 31.