add: printf exercises
This commit is contained in:
23
07-printf/exercises/10-print-your-fullname/solution/main.go
Normal file
23
07-printf/exercises/10-print-your-fullname/solution/main.go
Normal file
@ -0,0 +1,23 @@
|
||||
// For more tutorials: https://blog.learngoprogramming.com
|
||||
//
|
||||
// Copyright © 2018 Inanc Gumus
|
||||
// Learn Go Programming Course
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// WARNING: This program will error
|
||||
// if you don't pass your name and lastname
|
||||
|
||||
name, lastname := os.Args[1], os.Args[2]
|
||||
|
||||
msg := "Your name is %s and your lastname is %s.\n"
|
||||
fmt.Printf(msg, name, lastname)
|
||||
}
|
Reference in New Issue
Block a user