CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2012
    Posts
    1

    I need help please.

    If someone could please help me with this program

    1. Write a C program that prints numbers from 1 to 104, each 8 numbers on a separate line, at the end of each line find the sum of its numbers. Use only one if statement inside a while loop statement.

    For example, 1 2 3 4 5 6 7 8 a sum of 36 9 10 11 12 13 14 15 16 a sum of 100 . . 97 98 99 100 101 102 103 104 a sum of 804

    (Hint: compare the result of modulus 8 to zero)

    2. The factorial of a nonnegative integer n is written n! (Pronounced “n factorial”) and is defined as follows: n! = n .(n-1) . (n-2). …… .1 (for values of n greater than or equal to 1) and n! =1 (for n =0). For example, 5! = 5 . 4 . 3 . 2 . 1, which is 120.

    2.a) [30] Write a C program to calculate n!

    2.b) [30] Write a C program to calculate F=

    2.c) [40] Write a C program that estimates the value of the mathematical constant e by using the formula:

    2b its suppose to be F=1/1 + 1/2+1/3....+1/10

    and for 2c the formula is e=1 + 1/1! + 1/2!+.....+1/10!

    Thank you in advance

  2. #2
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,539

    Re: I need help please.

    Post what code you have done so far...we help you with your code...we don't do your homework for you.
    Jim
    ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII

    "The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.

    "Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: I need help please.

    Quote Originally Posted by rayray21 View Post
    If someone could please help me with this program
    The way it works here is this:

    You write the program first -- then if there is something that you don't understand, then ask. Just posting the assignment verbatim as you've done isn't going to get you help.

    Regards,

    Paul McKenzie

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: I need help please.

    Quote Originally Posted by quixomatic View Post

    Haven't tested this, but it should work. If not it shouldnt require too many alterations..
    I guess you're unfamiliar with the forum's policy of not doing homework. Did you miss Paul's post right before yours about how one should go about getting help? It would be best if you delete your post.

  5. #5
    Join Date
    Oct 2012
    Posts
    9

    Re: I need help please.

    Quote Originally Posted by GCDEF View Post
    I guess you're unfamiliar with the forum's policy of not doing homework. Did you miss Paul's post right before yours about how one should go about getting help? It would be best if you delete your post.
    Sorry for wanting to give someone a nudge in the right direction...sometimes the fastest way to learn is to see how it should look. Did you learn how to code from scratch or did you look at other people's code and emulate what they did? I'm happy to delete it but someone could have easily explained what should be done in pseudocode instead of referring to forum rules.

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: I need help please.

    Quote Originally Posted by quixomatic View Post
    Sorry for wanting to give someone a nudge in the right direction...sometimes the fastest way to learn is to see how it should look. Did you learn how to code from scratch or did you look at other people's code and emulate what they did? I'm happy to delete it but someone could have easily explained what should be done in pseudocode instead of referring to forum rules.
    So go ahead and delete it. Paul, with over 26,000 posts, explained how it works. You show that you're at least trying and lots of people will help. Come in here and just dump your assignment with no effort at all won't, and shouldn't get any help.

    I learned to program by doing it, not by having people do it for me.

    Here's the FAQ about homework.
    http://forums.codeguru.com/showthrea...ork-assignment

    "The bottom line: Feel free to ask homework questions here, but only if you have already put some significant effort into solving it yourself and are stuck on specific details. Don't expect to lean back and have others do the work for you."
    Last edited by GCDEF; October 20th, 2012 at 07:02 PM.

  7. #7
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,539

    Re: I need help please.

    Quote Originally Posted by quixomatic View Post
    Did you learn how to code from scratch or did you look at other people's code and emulate what they did?
    Actually read the textbook and listened to lectures and did some research....
    Jim
    ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII

    "The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.

    "Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured