(04-23-2023, 04:02 PM)david_uwi Wrote: A program for big factorials (not using strings). It was written to work with QB4.5
Code: (Select All)DefInt A-S
mx = 32000
Dim f(mx) As Integer
Input "input number"; n
f(mx) = 1
m = mx
For i = 2 To n
For j = mx To m Step -1
f(j) = f(j) * i + ic
ic = f(j) \ 10
f(j) = f(j) Mod 10
Next j
While ic <> 0
m = m - 1
f(m) = f(m) + ic
ic = f(m) \ 10
f(m) = f(m) Mod 10
Wend
Next i
For j = m To mx
Print Using "#"; f(j);
Next j
Print " ="; n; "!"
Very interesting, I wonder if can take place of String Math or do more tricks with this.
b = b + ...