Ad
  • Custom User Avatar

    You don't need to check the (count > 2) every iteration (there may be millions of them) - only when count changes...

  • Default User Avatar

    Hi,

    I'm not a C# coder but I noticed two problems with your code.

    1. The for loop increments even after you exit the loop
    2. When you do pstart <= pmax in your for loop, you are going add one more year to your counter.
      For example, if p is 1100 and p0 is at 1000, aug is 0 and percent is 10 then you'd count up once to make p0 = 1100
      but because p0 is still equal to pmax it increments again.
  • Default User Avatar

    Description says:

    Note: Don't forget to convert the percent parameter as a percentage in the body of your function: if the parameter percent is 2 you have to convert it to 0.02.

  • Default User Avatar

    Ive spent like an hour trying to figuere out what was wrong with my code when all I had to do is to divide the percent with 100 ffs.