Thread: Homework

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    7

    Homework

    Hello there,
    my teacher gave us a homework at C but i couldnt figure that out
    can any one please solve it? or give me directions
    Thank you in advance.

    ln n/e^n (from n=1 to infinity)

    Write a C program which will find the sum of the N-terms of the above
    convergent series. The program will consist of a MAIN function and a
    function.

    Within the MAIN function.
    . Number of terms N will be read from the standard input.
    . N will be passed to the function as an argument.
    . Sum of the N terms(return value from the function) will be printed.

    Within the function.
    . Sum of the N terms of the given series will be calculated and returned
    to the MAIN function.

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    7
    ok sorry. i didnt read that .

  4. #4
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    This is not a difficult assignment and you can easily get it done with guidance from us, but you have to show some work of your own, we will not do the entire thing for you. Even if you do get the answer from somewhere else, trust me mate, it will be a total waste of your time on the long run. Nobody can learn for you but yourself. You just need to get yourself to start.

    I suggest you start off with a program skeleton identifying the functions you need, the variables you will need, the includes and how you plan to approach the problem. Then, we will move on from there.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help about homework
    By agathery in forum C Programming
    Replies: 27
    Last Post: 05-19-2010, 09:17 PM
  2. Homework
    By kermi3 in forum C Programming
    Replies: 10
    Last Post: 09-27-2001, 04:49 PM
  3. Homework
    By kermi3 in forum C++ Programming
    Replies: 15
    Last Post: 09-26-2001, 03:16 PM
  4. Homework
    By kermi3 in forum Windows Programming
    Replies: 5
    Last Post: 09-15-2001, 11:48 AM
  5. Homework
    By kermi3 in forum C Programming
    Replies: 0
    Last Post: 09-10-2001, 01:26 PM