Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Sudan-function/PureBasic/sudan-function.basic
Normal file
30
Task/Sudan-function/PureBasic/sudan-function.basic
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
Procedure.d F(n.i, x.i, y.i)
|
||||
If n = 0
|
||||
ProcedureReturn x + y
|
||||
ElseIf y = 0
|
||||
ProcedureReturn x
|
||||
Else
|
||||
ProcedureReturn F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y)
|
||||
EndIf
|
||||
EndProcedure
|
||||
|
||||
OpenConsole()
|
||||
For n = 0 To 1
|
||||
PrintN("Values of F(" + Str(n) + ", x, y):")
|
||||
PrintN("y/x 0 1 2 3 4 5")
|
||||
PrintN("---------------------------------------------------")
|
||||
For y = 0 To 6
|
||||
Print(Str(y) + " |")
|
||||
For x = 0 To 5
|
||||
Print(#TAB$ + F(n,x,y))
|
||||
Next x
|
||||
PrintN("")
|
||||
Next y
|
||||
PrintN("")
|
||||
Next n
|
||||
|
||||
PrintN("F(2,1,1) = " + Str(F(2,1,1)))
|
||||
PrintN("F(3,1,1) = " + Str(F(3,1,1)))
|
||||
PrintN("F(2,2,1) = " + Str(F(2,2,1)))
|
||||
Input()
|
||||
CloseConsole()
|
||||
Loading…
Add table
Add a link
Reference in a new issue