I have to program in BASIC a code to do this:
From a collection of 10,000 cannonballs, a square based pyramid is built with a single cannonball on top and a square number on each layer. How many layers can be made? How many cannonballs are left over?
(I have tried 50 different codes BUT ALL of them throw the incorrect answers... Please if you can help me I would appreciate it very much!)