B = cint(InputBox("Masukkan Bilangan"))
document.write "Factorial dari " & B & " adalah " & Fact(B) & "
"
CALL CalcFact(B,H)
document.write "Factorial dari " & B & " adalah " & H & "
"
FUNCTION Fact(byVal N)
IF N>0 THEN
Fact = N * Fact(N-1)
ELSE
Fact = 1
END IF
END FUNCTION
SUB CalcFact(byVal N, byRef F)
IF N>0 THEN
CALL CalcFact(N-1, temp)
F = N * temp
ELSE
F = 1
END IF
END SUB
No comments:
Post a Comment