I'll quote http://dinosaur.compilertools.net/flex/flex_10.html
*When the scanner receives an end-of-file indication from YYINPUT, it then checks the yywrap() function
So, if you simulate EOL behaviour using ctrl-d (after entering the number and pressing the return key), you can see that your calculations are correct.
If you want to see the results immediately, you will have to write the output after you compute it.
Cheers