- Joined
- Apr 13, 2011
- Messages
- 15,910
- Reaction score
- 12,630
- Location
- Plano, Texas
- Gender
- Female
- Political Leaning
- Other
I've been assigned a project in which I have to code a program that will calculate a factorial.
I've used several different versions of the formula that I've found through searches, but it still won't calculate anything correctly beyond factorials of 3. It appears as if my loop is the issue, but I can't figure out what I've done wrong.
The factorial must be calculated for any whole number between 2 and 60...here's what I put in the code:
not sure why it isn't working. Looks like every other code I'm finding is similar to that, except the parameters in the "for" clause are slightly different based on their limits.
Any ideas?
I've used several different versions of the formula that I've found through searches, but it still won't calculate anything correctly beyond factorials of 3. It appears as if my loop is the issue, but I can't figure out what I've done wrong.
The factorial must be calculated for any whole number between 2 and 60...here's what I put in the code:
(counter = 1; counter <= 60; counter--);
factorial = number * (number - counter);
not sure why it isn't working. Looks like every other code I'm finding is similar to that, except the parameters in the "for" clause are slightly different based on their limits.
Any ideas?