Site hosted by Angelfire.com: Build your free website today!

Factorial

(Back)
Email the author:REGGIE


You will probably be thinking to yourself right now that the EL-9600 is preprogrammed to do factorials. It is! But the EL-9600 can only do up to the factorial of 69, 70 is to high for it to calculate. 69! gives you: 1.711224524e98. This is the problem: The EL-9600 is only programmed to do up to X*10e99, any number of factorial over 69 will exceed the limit of the 99 max exponent. Therefore to get around this, I simply make up my own exponent type thing. By counting how many times the program divides by 10 (which is every time the program detects that the number is over ten), I get my exponent. For example: 400! is 6.403452285*10e868. The problem is that it is pretty slow when calculating a big number. I don't know if you can find a use for the program, and I don't really care. I programmed it just because my math teacher told me it was imposible. HA! The '=>' means STO.

Print "A!"
Input A
A=>B
0=>U
Label F
If B>10Goto P
If A=1GotoE
B*(A-1)=>B
A-1=>A
Goto F
Label P
B/10=>B
U+1=>U
Goto F
Label E
Print B
If U=0Goto L
Print "*10 TO THE EXPONENT"
Print U
Label L
End