Computer Science Canada turing - help w terms |
Author: | comp_help [ Mon Apr 13, 2009 3:59 pm ] | ||
Post subject: | turing - help w terms | ||
What is it you are trying to achieve? I am trying to make this program work with user input for the number of terms which is less than 3. What is the problem you are having? This code doesn't work if the user input is less than 3 for the number of terms. Describe what you have tried to solve this problem I have made a code. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) Code is below:
Please specify what version of Turing you are using Turing 4.1.1 |
Author: | andrew. [ Mon Apr 13, 2009 4:12 pm ] | ||
Post subject: | RE:turing - help w terms | ||
It doesn't work because you start n off with 2 before you go into the loop. If you put 2 or less, then the loop will never exit and you will have an overflow. You have to put the exit statement first in the loop.
|
Author: | comp_help [ Mon Apr 13, 2009 5:08 pm ] |
Post subject: | RE:turing - help w terms |
andrew thanks for that, now it does work for 2 ![]() But it doesn't seem to work for 1. Should/Can I put an exit statement outside(before) the loop. |
Author: | comp_help [ Mon Apr 13, 2009 5:12 pm ] |
Post subject: | Re: turing - help w terms |
Nvm, I got it working ![]() I removed the code outside the loop and it seems to be working. Thanks anyway andrew. |
Author: | andrew. [ Mon Apr 13, 2009 7:17 pm ] |
Post subject: | RE:turing - help w terms |
No problem. |