Help with program

I need help to write this C not C++. Thanks very much for the help whoever helps me.

1) The factorial of a number x is given as (recursive version and iterative version respectively):
i. Fac( x )={1 if x= 0
x∗Fac(x−1) ifx>1 }

ii. Fac(x )=x∗(x−1)∗(x−2)∗(x−3)∗…∗1

a. Write separate algorithms for both versions (iterative and recursive) using pseudocode

b. Build a trace table (using x = 5) for both versions to ensure they perform as expected

c. Convert both algorithms into C code on paper

d. Create a folder called Repetition

e. Using your IDE, create a C project called Factorial in the folder called Repetition

f. Write a main module in C that displays “Calculating factorials using repetition” and pauses
until the user presses a key, then ends.

g. Write a C module called Fact() that implements your iterative algorithm from a. above, and
place the module below main() in the C sources section. Remember to write the prototype
for the function above main().

h. Call the Fact() module from main() with 5 as the argument and display the result returned.
Do not modify the Fact() module in any way (no display or hardcoding of 5). For example,
from main(), your program should display “The factorial of 5 is 120”. Run the program.

i. Comment out the iterative Fact() module you wrote in g. above.

j. Write a new C module called Fact() that implements your recursive algorithm from a.
above, and place the module below main() and the iterative version of Fact(), in the C
sources section. Do not modify the function prototype above main() or the function call
from main().

k. Run the program again. The results should be the same as before.
closed account (jwkNwA7f)
We are not going to do your homework for you!!!!!
This about the 20th+ question this week asking that.

You need to show effort. When you run into a problem, then you can ask for help about it. It says this in the forum rules.
This is not a home work, so for you information you need to ask questions before you make assumptions!!! I am new to programming and came across this question trying to figure out where to start.
if you are asking for C why ask in the C++ forum ... ?

I never code in C before, but at least I know that some part of C are just not so different

perhaps, start by installing an IDE ... ( Codeblocks, Visual Studio, etc.. )
closed account (jwkNwA7f)
@redice2413 Sorry, my mistake. It has just been driving me insane with all these people ask us to there home work for them.
I have microsoft visual c++ 2010 express installed. I am trying to learn C on my own.
A friend of mine told me about this website. Just thought I could get some help here.
I think the reason you got this reaction is that the original question contains step-by-step instructions on what you need to do. In other words, there is already a lot of helpful information in the question itself. You just need to start at step a. and work through it a step at a time.

ok will do what i can and post it. then i will post it...
Iteration Version

Pseudo-code

START
DECLARE count, F,x as INTEGER
WRITE "ENTER FACTORIAL"
READ F
for count <--- F to 0 STEP 1
x <-- X * count
END FOR
WRITE x
STOP


C-code

int factorial (int F)

int factorial (int F) {
int x = 1;
for (count = F; count > 0; count - -)
{
x = x * count;
print (%d \n; x);
}
return x;
}

I am not sure if this correct. How do i do the recursive version for the c-code and the pseudocode?

the trace table is no problem that part of the question can b omitted i just need help with the pseudocode and c-code for the recursive version...
Topic archived. No new replies allowed.