I know what the problem was (first version):
On line 4 you declared a function printMagSqrd().
On line 13 you declared an int printMagSqrd, which probably overrode the function.
On line 15 you called printMagSqrd(). You either got an error saying printMagSqrd isn't a function or the linker complained that you didn't implement the function.
I have a few questions about the second version:
What's printMagSqrd() for?
What's int printMagSqrd for?
Why do you input data one line before the end of the program?