stops reading a number when it meets a non-digit character: so when you do this:
printf("the square is %d" ,num*num);
the ENTER your user added to end the numeric value remains in the buffer.
And then you do this:
So it retrieves the next character and returns the ENTER instead of the user's next input.
To check that, run your code as is, and enter "123y" instead of "123" and press ENTER.
To fix the problem, write a function called ClearInputBuffer:
while ((c = getchar()) != '\n' && c != EOF)
And call that after each time you read a "separate input" from the user to clear out the rest of the line.