How can I explain this without giving away too much
What do you think this line does?
Write('ENTER NUMBER OF SECTIONS TO BE CONSIDERED ON THE BEAM: ',ns);
And what do you think this line does?
I don't see anywhere where you ask for input for the variable ns.
I see you outputting ns to the screen.
And I see you asking for the user to enter a (any) line.
But nothing about inputting ns.