Data update
This commit is contained in:
parent
5af6d93694
commit
796d366b97
455 changed files with 7413 additions and 1900 deletions
14
Task/Leonardo-numbers/EasyLang/leonardo-numbers.easy
Normal file
14
Task/Leonardo-numbers/EasyLang/leonardo-numbers.easy
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
proc leonardo L0 L1 add . .
|
||||
print "L0:" & L0 & " L1:" & L1 & " add:" & add
|
||||
write L0 & " "
|
||||
write L1 & " "
|
||||
for i = 2 to 24
|
||||
tmp = L0
|
||||
L0 = L1
|
||||
L1 = tmp + L1 + add
|
||||
write L1 & " "
|
||||
.
|
||||
print ""
|
||||
.
|
||||
leonardo 1 1 1
|
||||
leonardo 0 1 0
|
||||
24
Task/Leonardo-numbers/Odin/leonardo-numbers.odin
Normal file
24
Task/Leonardo-numbers/Odin/leonardo-numbers.odin
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
/* imports */
|
||||
import "core:fmt"
|
||||
/* main */
|
||||
main :: proc() {
|
||||
fmt.println("\nThe first 25 Leonardo numbers with L[0] = 1, L[1] = 1 and add number = 1 are:")
|
||||
result := leonardo(25, 1, 1, 1)
|
||||
fmt.println(result)
|
||||
delete(result)
|
||||
fmt.println("\nThe first 25 Leonardo numbers with L[0] = 0, L[1] = 1 and add number = 0 are:")
|
||||
result = leonardo(25, 0, 1, 0)
|
||||
fmt.println(result)
|
||||
delete(result)
|
||||
}
|
||||
/* definitions */
|
||||
leonardo :: proc(n, l0, l1, add: int) -> []int {
|
||||
leo := make([]int, n)
|
||||
leo[0] = l0
|
||||
leo[1] = l1
|
||||
for i in 2 ..< n {
|
||||
leo[i] = leo[i - 1] + leo[i - 2] + add
|
||||
}
|
||||
return leo
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue