Why does it always show even number if I type any letter
When you enter a string scanf fails to parse an integer. The value of "number" remains as before (0 in this case for some reason). 0 is an even number. Try to run this code with a single character as input to see how the char remains in buffer after the first scanf: https://code.sololearn.com/cSyNY6r7GRVu/?ref=app
If number is divided by 2 then it is even number otherwise not
Recheck again. It will show different for even, odd numbers. edit: Oh. Any letter? Nishit Mehta your program don't read any char. it only can read an integer.