1 Answer

  1. Leander- Reply

    2019-11-14

    When using ints with division the value is calculated and then truncated to int.
    if you divide int by int you should do something like:
    return (n/(double)2) * ((2 * x0) + ((n - 1) * (r)));

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>