## iop360 Group Title how to write a factorial in C++ one year ago one year ago

• This Question is Open
1. ammar-93 Group Title

factorial !! explain more plz !!!

2. iop360 Group Title

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

3. iop360 Group Title

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

4. iop360 Group Title

is there an operator for that

5. iop360 Group Title

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

6. ammar-93 Group Title

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. iop360 Group Title

ok

8. iop360 Group Title

how would i write this

9. iop360 Group Title

most efficiently

10. ammar-93 Group Title

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

11. iop360 Group Title

is that all you would type

12. iop360 Group Title

what does i mean

13. ammar-93 Group Title

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. iop360 Group Title

ok thanks

15. eSpeX Group Title

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