How do i do partial sums?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tpdinh
    New Member
    • Oct 2006
    • 4

    How do i do partial sums?

    I have to evaluate the sum in the for-loop. How do i do that?
    Also, I need to print the partial sums using %e. Please help!
  • D_C
    Contributor
    • Jun 2006
    • 293

    #2
    Code:
    int i;
    int sum = 0;
    for(i = FIRST_VALUE; i < STOP_VALUE; i++)
    {
      sum += f(i);
    }

    Comment

    • tpdinh
      New Member
      • Oct 2006
      • 4

      #3
      hi,
      what does the f means?
      Please reply.
      thanks




      Originally posted by D_C
      Code:
      int i;
      int sum = 0;
      for(i = FIRST_VALUE; i < STOP_VALUE; i++)
      {
        sum += f(i);
      }

      Comment

      • tpdinh
        New Member
        • Oct 2006
        • 4

        #4
        Sorry to bother you but I have a program that i've been working for more than two hours. and still couldn't finish. The problem states:
        In the forloop evaluate the sum (between any real number that you enter on scanf and any large number such as n_end that you input on scanf also). in addition, print the partial sums using %16.8e for n=10,20,30,...
        Can you please help!


        Originally posted by D_C
        Code:
        int i;
        int sum = 0;
        for(i = FIRST_VALUE; i < STOP_VALUE; i++)
        {
          sum += f(i);
        }

        Comment

        Working...