## anonymous 3 years ago how to write a factorial in C++

• This Question is Open
1. anonymous

factorial !! explain more plz !!!

2. anonymous

3 factorial = 3! = (3*2*1)

3. anonymous

so say i want $\frac{ x^3 }{ 3! }$

4. anonymous

is there an operator for that

5. anonymous

or would i just type it out as (3*2*1)

6. anonymous

I got it , I'll explain the algorithm : we can write a loop like this : for i is from x to 1 then : x! = x * (x-1)

7. anonymous

ok

8. anonymous

how would i write this

9. anonymous

most efficiently

10. anonymous

for example .. to calc 5! : for i= 1 to 5 do x!=x(x-1) is it clear ?

11. anonymous

is that all you would type

12. anonymous

what does i mean

13. anonymous

I'm sorry I'll not write the code to you , I've told you the idea and U've to try ... good luck

14. anonymous

ok thanks

15. eSpeX

@iop360 Try writing the steps out by hand, then look at the process you used and replicate it in your code.