Example Program to calculate Factorial
|
01-31-2018, 10:54 PM
Post: #10
|
|||
|
|||
RE: Example Program to calculate Factorial
(01-31-2018 08:47 PM)Thomas Okken Wrote: HP-25 style: (01-31-2018 10:04 PM)Gerson W. Barbosa Wrote: 0h, and I thought mine was good enough… At least now I know what I could have done to save yet one more step. Thanks! Then add two steps penalty. ;-) Here's my HP25 / HP33E/C version: Code: 01 ABS Make sure input is not negative A bit cleaner than Thomas' version and one step shorter than Gerson's (if you add ABS INT). And finally it even works with calculators that only feature a very limited set of test commands – only x=0? is required. BTW all this is better than HP's own factorial program in the HP25 Applications Programs book (p. 110) which requires one register and does not even handle 0! correctly. Instead it gets stuck in an infinite loop... #-) Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 6 Guest(s)