help/understand on a problem

This is a discussion on help/understand on a problem within the C++ Programming forums, part of the General Programming Boards category; i tried over and over again but could never find and understand how to solve this problem. please help. Write ...

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    1

    help/understand on a problem

    i tried over and over again but could never find and understand how to solve this problem. please help.

    Write a function that accepts two arguments, integer n and real number x, computes the following series, and returns the computed result:

    1 - 2(x^2)/1! + 3(x^4)/2! - 4(x^6)/3! + ... + [(-1)^n](n+1)(x^2n)/n!

    here are some answers when computing.

    n= 3 10 15 20
    x= 2 2 2 2
    Ans= -25.666668 0.865679 -0.057734 -0.054947

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    242
    consider loops

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    266
    n! is

    for(int i=n,ans=1;i>=2;--i)
    ans*=i;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 05:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21