Posts: 1,356
Threads: 58
Joined: Jul 2022
Reputation:
53
The line containing the "2.7128F" is a comment, would not get compiled by C/C++ but...
Whoever wrote that code tried to take a shortcut and failed. But a supercomputer and some other programming language would have to adopt the formula of the first post of this topic.
Posts: 957
Threads: 52
Joined: May 2022
Reputation:
38
And why does it work in the second program? The declaration is exactly the same.
I know this is no longer necessary in QB64, but for me it's for clarity.
Posts: 4,708
Threads: 224
Joined: Apr 2022
Reputation:
322
(04-22-2023, 09:30 PM)Kernelpanic Wrote: And why does it work in the second program? The declaration is exactly the same.
I know this is no longer necessary in QB64, but for me it's for clarity.
This kept the program from running infinitely.
Code: (Select All)
If n > 0 Then
fak = n * fakultaet(n - 1)
End If
Though its kinda odd it did stop and print the factorial.
The first program kept subtracting 1 from n with no bottom limit.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever