Aug 24, 2004 18:27
Square Program:
PROGRAM: SQUARE
:ClrHome
:Input X
:0
:For(I,1,2X-1,2
:Ans+I
:Disp Ans
:End
PROGRAM: SQUARE ROOT
:ClrHome
:Input X
:DelVar I
:While X =/0 [=/ is "does not equal"]
:X-1-2I->X [-> is "store as"]
:I=1->I
:Disp I
:End
By request of my cousin Evan, I wrote these out. And they are currently built to display all of the subtraction so you can see it at work. I tihnk it is rather cool. If you just want to see the final answer, and not that other mumbo jumbo, then just move the Disp command after the end.
Bugs - This only works for whole numbers, and of course not negative numbers. If the program just keeps running, wither you need to pick a smaller number, or you did something wrong. If you think I screwed up, please tell me, and give me your home address and times your home will be empty so I may pillage...erm...leave you a care package... :p
Enjoy.
99.9% of the people that just read this are now thinking, "...wtf was all that...??" Don't worry you are not alone. This is just a little rant on my part that I JUST learned how to actually to a square root without already knowing the answer, or doing guess and check. And I don't know of many others who can do this. And that is sad. A fifth grader knows what a square root is, but the majority will never learn how to do one manually.