Now before y'all say that factorials are built in functions using the "!", my math teacher asked if a could make a simple program that would do factorials. So far this is what I have, but it doesn't work, not even a little bit.

Code:
``` Input "N: ",A While A>0 A(A-1)->B A-1->A BA->C End Disp C ```

Now just looking at this I know it won't work, but I tend to get confused with some of the variables, and storing answers in "ans" maybe, I'm not really sure. Thanks for your help!
I find it much easier to count up than down. In your code, you subtract 1 from A twice. I'm not sure why.

Something like this perhaps?

Code:
```Input "N: ",A 1:For(B,1,A BAns:End Disp Ans```
MateoConLechuga wrote:
I find it much easier to count up than down. In your code, you subtract 1 from A twice. I'm not sure why.

Something like this perhaps?

Code:
```Input "N: ",A 1:For(B,1,A BAns:End Disp Ans```

It works great and thanks. How does this program add to B?
You can do it in one line of code, which is runnable on the homescreen:
prod(cumSum(binomcdf(Ans-1,0
Usage:
10:prod(cumSum(binomcdf(Ans-1,0
(Calculates 10!, and 10 can be replaced with any numbers less than 69, because overflow, and less than 1, because domain errors. Note that this does fail on 0!, but if you know 0! = 1, that's no problem.)

Or, you can do it recursively:
prgmA:

Code:
```If not(Ans Then Ans-1:prgmA End```

Usage:

5:prgmA
(Calculates 5!, and 5 can be replaced with any number less than 69, because overflow, and greater than -1, because logic. .)
I know that this is off topic, but on my ti 84 pce, trying to graphs x! does not work. It just graphs one point, even though the table is correct. Any ideas?
Legoman314 wrote:
I know that this is off topic, but on my ti 84 pce, trying to graphs x! does not work. It just graphs one point, even though the table is correct. Any ideas?

This is indeed completely unrelated to the thread, and you should make a new topic for this (It is quite likely that an admin will jump in and move this)
As for your issue, sounds like someone is in plot mode
If this is the case, which I strongly suspect, then just run PlotsOff on your home screen, and you should be good to go
Thanks for the suggestion!
I tried to make this program a little more user-friendly by making sure that it won't overflow, and making a menu that allows the user to start over with a new number. However, when it reaches the men command, it gives an error data type.

Code:
``` Lbl A Input "N: ",A If A>68 Disp "Number too large" If A>68 Goto A 1:For(B,1,A BAns:End Disp Ans Pause Menu("Again",A,"Quit",B Lbl B Return ```

Im not sure why this is coming up. Thanks in advance.

Code:
`Menu("TITLE","Again",A,"Quit",B`

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are UTC - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum