It works great for me, how are you trying to complete the program? for -loop should end once EOF is defined as getchar() input.
EOF - Control-Z ( ^Z ) on Windows and Control-D ( ^D ) on Linux / Unix. As soon as I get into this, the loop ends and I get the final printf() to display its output.
As a final note (as @DanielFisher was also mentioned), add '\n' to the end of your final printf() call, as this may be required by your specific implementation or else the program behavior may be undefined (thanks @KeithThompson and @AndreyT, specifying this in comments):
printf ("Why does this work, nc = %f\n", nc);
Levon source share