Hello M.h.f - New member in need of some help.

Hello everyone,

As the title says this is my first post, as my ability in math grows I hope to give help and not just ask for it! Anyway...

Long story short I have recently began self study into computer programming and enjoying it very much. It quickly came to my attention that math (discrete math) is at work here. My travels through the net also lead me to believe that some take the "well you can still do alot without math!" approach (not pointing fingers).

However I want to learn and understand the math and am prepared to work at it. To that extent I've purchased a book (bet you didn't see that coming) explaining the math to help me get started. I'm rather annoyed (with myself?) however to say that not far in and the problems have begun...but not wanting to give up I have come to get some help.

The question is below and is algebraic in nature I believe;

This is in pseudo code by the way but hopefully wont hinder much;

if; a) n = 3

b) n = 5

begin

f := 1;

input n;

for i := 1 to n do

f := f * i

Output f;

end

The book gives answers of f = 6 and f = 120 respectively.

If someone could explain just how these answers are being reached as I feel as though I understand then upon checking with the answers that conception goes up in smoke.

Thank-you in advance for any help,

- Jamie.