Posted: Thu Mar 05, 2009 11:50 am Post subject: Long division in turing
I looked throught the f10 page and i couldn't find a preset bit of code to do this so i thought i would make it myself. here is what i have
p.s. (stuff in here)= code i don't know
Turing:
Var divider :real var dividee :real put"please input first number" get divider
put"please input second number" get dividee
If (first digit of) divider >(first digit of)dividee then(switch divider & dividee) elseendif
If (first digit of) divider <(first digit of) dividee then.....
anyone care to finish it off? or change it completely cuz i am a noob and did it wrong?
Sponsor Sponsor
DemonWasp
Posted: Thu Mar 05, 2009 1:16 pm Post subject: RE:Long division in turing
We aren't going to solve the problem for you, but we will tell you HOW to go about solving the problem.
First, determine how you do long division. Do some long division with pen and paper. Look for patterns in what happens - you should be able to reduce long division to a few steps that you do over and over.
Once you've figured out what the steps are, determine what variables you'll need. You need one for the divisor (number being divided), one for the dividend (number you're dividing by), one for the quotient (result) and another for the remainder.
Once you've got your steps and variables worked out, you should be able to write code to do those steps for you. If not, post what you discovered from working with pen-and-paper and we'll walk you through converting that to code.