January 21st, 2014, 12:45 PM
return $n * factorial_of_a_number($n-1);
when i run this program it gives correct result..but i dint understand " return $n * factorial_of_a_number($n-1); "....this statement.....when i looked i felt like its giving a result 12...i know its wrong..but how is it possible??? can anyone help please??
January 21st, 2014, 12:48 PM
What are you doing? Just putting together snippets of code and then asking us why they do what they do? This is the second silly post you have put up.
Instead of getting others to do your thinking for you, why don't you do your own research and teach yourself something?
January 21st, 2014, 01:03 PM
if i found what i needed..do you think i would ask you to help me??
January 21st, 2014, 01:06 PM
Please use more descriptive thread titles than "Doubt". That tells us nothing, and worse it makes us think you're creating multiple threads for the same question.
That line is recursion: having a function call itself repeatedly. It works well for factorials because of how factorials work. As for returning 12, I don't know why because there's no number that has a factorial of 12.