feat: Demo-Examples (Python/Rust/Go/C) mit Protokoll-Templates und Restore-Skript
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fb4e96919a
commit
64c2b7f0fd
21 changed files with 614 additions and 0 deletions
18
examples/go-fibonacci/main.go
Normal file
18
examples/go-fibonacci/main.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
// fib berechnet die n-te Fibonacci-Zahl rekursiv.
|
||||
// Korrekt, aber für n > 40 sehr langsam (exponentiell).
|
||||
func fib(n int) int {
|
||||
if n <= 1 {
|
||||
return n
|
||||
}
|
||||
return fib(n-1) + fib(n-2)
|
||||
}
|
||||
|
||||
func main() {
|
||||
for i := 0; i <= 10; i++ {
|
||||
fmt.Printf("fib(%2d) = %d\n", i, fib(i))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue