Computer Science Canada Help with Calculating Compound interests in loop |
Author: | nmr123321 [ Tue Oct 18, 2005 7:59 pm ] | ||
Post subject: | Help with Calculating Compound interests in loop | ||
I new this is so newbish problem but i am only learning turing for like 20 days Please tell me what am i doing wrong Question Calculate Compound interest in 10 years for eack year with the initial amount of 1000 and rate of 6%
|
Author: | beard0 [ Tue Oct 18, 2005 8:36 pm ] |
Post subject: | |
Balance and interest you have as integers, they need to be of type real, because when you multiply by 0.06, you don't get an integer answer. When you're looking for help after getting an error message, please post the error message. |
Author: | lyam_kaskade [ Tue Oct 18, 2005 8:38 pm ] | ||||||
Post subject: | |||||||
Hmm... the loop doesn't have an exit condition. Try
before the end of the loop. And then another output statement after the loop, so it shows the final result. Also, instead of
You can put
Not that it's a big deal, just makes code more readable. |
Author: | nmr123321 [ Tue Oct 18, 2005 8:46 pm ] |
Post subject: | |
thanks a lot guys+bits |
Author: | nmr123321 [ Tue Oct 18, 2005 8:49 pm ] |
Post subject: | |
i'm trying to donate bits but i am getting the following message Could not update points log DEBUG MODE SQL Error : 1136 Column count doesn't match value count at row 1 UPDATE v3_users SET user_points = user_points + 5 WHERE user_id = 1516 Line : 179 File : /home/compsci/public_html/v2/pointscp.php |
Author: | beard0 [ Tue Oct 18, 2005 9:13 pm ] |
Post subject: | |
Don't worry about it. The bit donation system has been down for a while now. |
Author: | MysticVegeta [ Wed Oct 19, 2005 2:37 pm ] |
Post subject: | |
Why not use the formula? CI = P(1+r)^n In turing it would be var CI : real := 1000 * ( (1 + .06) ** 10) No need for a loop! |
Author: | beard0 [ Wed Oct 19, 2005 2:44 pm ] |
Post subject: | |
MysticVegeta wrote: Why not use the formula?
CI = P(1+r)^n In turing it would be var CI : real := 1000 * ( (1 + .06) ** 10) No need for a loop!
|
Author: | MysticVegeta [ Wed Oct 19, 2005 2:46 pm ] |
Post subject: | |
oh sorry I misunderstood the point. |
Author: | beard0 [ Wed Oct 19, 2005 2:50 pm ] |
Post subject: | |
MysticVegeta wrote: oh sorry I misunderstood the point.
You didn't need to appologise. We forgive you your ignorance. I guess my reply was a little more hard-edged than I meant it to be... |