Computer Science Canada help with for statements |
Author: | battleroyale [ Mon May 02, 2005 4:41 pm ] | ||
Post subject: | help with for statements | ||
ok...for school, i need to make a mortage thing. Starting off with 120000 at 10.75% interest a year, i need to figure out when it will go down to zero if i pay 24000 a year. My teacher wants it like this Year Beginnnig Balance Interest Payment Year End Balance this is what i did so far
how do i make it so the for statement ends when c=0? |
Author: | AsianSensation [ Mon May 02, 2005 5:10 pm ] | ||
Post subject: | |||
use the exit statement.
|
Author: | battleroyale [ Mon May 02, 2005 5:13 pm ] | ||
Post subject: | |||
If you meant something like this
it doesnt work...it might be becuase of some eqaution but i dont know why. Help |
Author: | mike200015 [ Mon May 02, 2005 5:56 pm ] |
Post subject: | |
it ran fine? your for loop goes from 1 to 100, at 100, c only = 1.55 so there is no need for your exit when c = 0 |
Author: | c0bra54 [ Mon May 02, 2005 6:22 pm ] |
Post subject: | |
yeh but it ahs to goto zero, so just use maxint or anynumber lol, and then exitwhen c = 0 and makesure you include the last payment! |
Author: | battleroyale [ Mon May 02, 2005 6:34 pm ] | ||
Post subject: | |||
THis is what i did
works out fine too....uncomment it first though |