Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Sudan-function/Gambas/sudan-function.gambas
Normal file
31
Task/Sudan-function/Gambas/sudan-function.gambas
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
Function F(n As Integer, x As Integer, y As Integer) As Integer
|
||||
|
||||
If n = 0 Then Return x + y
|
||||
If y = 0 Then Return x
|
||||
Return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y)
|
||||
|
||||
End Function
|
||||
|
||||
Public Sub Main()
|
||||
|
||||
Dim n, x, y As Integer
|
||||
|
||||
For n = 0 To 1
|
||||
Print " Values of F(" & n & ", x, y):"
|
||||
Print " y/x 0 1 2 3 4 5"
|
||||
Print String(29, "-") 'Print " ----------------------------"
|
||||
For y = 0 To 6
|
||||
Print y; " | ";
|
||||
For x = 0 To 5
|
||||
Print Format$(F(n, x, y), "####");
|
||||
Next
|
||||
Print
|
||||
Next
|
||||
Print
|
||||
Next
|
||||
|
||||
Print "F(2,1,1) = "; F(2, 1, 1)
|
||||
Print "F(3,1,1) = "; F(3, 1, 1)
|
||||
Print "F(2,2,1) = "; F(2, 2, 1)
|
||||
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue