I need help please.
 CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

1. Junior Member
Join Date
Oct 2012
Posts
1

## I need help please.

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. ## 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.

3. Elite Member Power Poster
Join Date
Apr 1999
Posts
27,449

## Re: I need help please.

Originally Posted by rayray21
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. Elite Member Power Poster
Join Date
Nov 2003
Location
Florida
Posts
12,482

## Re: I need help please.

Originally Posted by quixomatic

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. ## Re: I need help please.

Originally Posted by GCDEF
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. Elite Member Power Poster
Join Date
Nov 2003
Location
Florida
Posts
12,482

## Re: I need help please.

Originally Posted by quixomatic
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. ## Re: I need help please.

Originally Posted by quixomatic
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....

#### 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

This a Codeguru.com survey!