umfangreicheres Beispiel

This commit is contained in:
2026-02-26 23:17:02 +01:00
parent 892242366b
commit 768cf306d0
2 changed files with 15 additions and 0 deletions

View File

@@ -7,5 +7,20 @@ import (
)
func main() {
var name string
var age int
fmt.Print("Bitte gibt Dein Alter ein: ")
fmt.Scan(&age)
if age < 18 {
fmt.Println("Du bist nicht volljährig")
fmt.Printf("Du brauchst noch %v Jahre", 18-age)
fmt.Println("")
} else {
fmt.Println("ok")
}
fmt.Print("Bitte gib Deinen Namen ein: ")
fmt.Scan(&name)
fmt.Println("Hallo " + name)
fmt.Printf("Du bist %v Jahre alt", age)
fmt.Println(quote.Go())
}