04-22-2023, 09:20 PM
@mnrvovrfc - I don't comprehended that in Julia.
I have a problem with the factorial in Julia. When testing with QB64, the same problem occurs - but somehow inexplicable, because a comparable program works.
Can someone explain the problem with the QB64 program? Thanks!
In Julia:
In QB64 the same problem:
That is working. Practically the same program.
I have a problem with the factorial in Julia. When testing with QB64, the same problem occurs - but somehow inexplicable, because a comparable program works.
Can someone explain the problem with the QB64 program? Thanks!
In Julia:
In QB64 the same problem:
Code: (Select All)
'Fakultaetbeispiel, siehe Julia - 22. April 2023
Option _Explicit
Declare Function fakultaet(n As Integer) As _Integer64
Dim As Integer n
Locate 3, 3
Input "Fakultaet(n) -> n: ", n
Locate 3, 5
Print Using "Fakultaet von ### ist: #####"; n, fakultaet(n)
End 'Hauptprogramm
Function fakultaet (n As Integer)
Dim As _Integer64 fak
fak = 1
fak = n * fakultaet(n - 1)
fakultaet = fak
End Function
That is working. Practically the same program.
Code: (Select All)
'Fakultaetbeispiel 2, siehe Julia - 22. April 2023
Option _Explicit
Declare Function fakultaet(n As Integer) As _Integer64
Dim As Integer n
Locate 3, 3
Input "Fakultaet(n) -> n: ", n
Locate 5, 3
Print Using "Fakultaet von ### ist: #####"; n, fakultaet(n)
End 'Hauptprogramm
Function fakultaet (n As Integer)
Dim As _Integer64 fak
'Das ist der Knackpunkt!
'Ansonsten ist fak offenbar Null
fak = 1
If n > 0 Then
fak = n * fakultaet(n - 1)
End If
fakultaet = fak
End Function