iop360
how to write a factorial in C++



This Question is Open

ammar93
Best Response
You've already chosen the best response.
0
factorial !! explain more plz !!!

iop360
Best Response
You've already chosen the best response.
0
3 factorial = 3! = (3*2*1)

iop360
Best Response
You've already chosen the best response.
0
so say i want \[\frac{ x^3 }{ 3! }\]

iop360
Best Response
You've already chosen the best response.
0
is there an operator for that

iop360
Best Response
You've already chosen the best response.
0
or would i just type it out as (3*2*1)

ammar93
Best Response
You've already chosen the best response.
0
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 * (x1)

iop360
Best Response
You've already chosen the best response.
0
ok

iop360
Best Response
You've already chosen the best response.
0
how would i write this

iop360
Best Response
You've already chosen the best response.
0
most efficiently

ammar93
Best Response
You've already chosen the best response.
0
for example .. to calc 5! :
for i= 1 to 5 do
x!=x(x1)
is it clear ?

iop360
Best Response
You've already chosen the best response.
0
is that all you would type

iop360
Best Response
You've already chosen the best response.
0
what does i mean

ammar93
Best Response
You've already chosen the best response.
0
I'm sorry I'll not write the code to you , I've told you the idea and U've to try ... good luck

iop360
Best Response
You've already chosen the best response.
0
ok thanks

eSpeX
Best Response
You've already chosen the best response.
0
@iop360 Try writing the steps out by hand, then look at the process you used and replicate it in your code.