Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
27
Task/Factorial/FreeBASIC/factorial.freebasic
Normal file
27
Task/Factorial/FreeBASIC/factorial.freebasic
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Function Factorial_Iterative(n As Integer) As Integer
|
||||
Var result = 1
|
||||
For i As Integer = 2 To n
|
||||
result *= i
|
||||
Next
|
||||
Return result
|
||||
End Function
|
||||
|
||||
Function Factorial_Recursive(n As Integer) As Integer
|
||||
If n = 0 Then Return 1
|
||||
Return n * Factorial_Recursive(n - 1)
|
||||
End Function
|
||||
|
||||
For i As Integer = 1 To 5
|
||||
Print i; " =>"; Factorial_Iterative(i)
|
||||
Next
|
||||
|
||||
For i As Integer = 6 To 10
|
||||
Print Using "##"; i;
|
||||
Print " =>"; Factorial_Recursive(i)
|
||||
Next
|
||||
|
||||
Print
|
||||
Print "Press any key to quit"
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue