Advertisement
Spocoman

06. Concatenate Data

Sep 12th, 2024 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.85 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var firstName, lastName string
  6.     fmt.Scanln(&firstName)
  7.     fmt.Scanln(&lastName)
  8.    
  9.     var age int
  10.     fmt.Scanln(&age)
  11.    
  12.     var town string
  13.     fmt.Scanln(&town)
  14.    
  15.     fmt.Printf("You are %s %s, a %d-years old person from %s.", firstName, lastName, age, town)
  16. }
  17.  
  18. ИЛИ:
  19.  
  20. package main
  21. import "fmt"
  22.  
  23. func main() {
  24.     var firstName, lastName,age, town string
  25.     fmt.Scanln(&firstName)
  26.     fmt.Scanln(&lastName)
  27.     fmt.Scanln(&age)
  28.     fmt.Scanln(&town)
  29.    
  30.     fmt.Println("You are " + firstName + " " + lastName + ", a " + age + "-years old person from " + town + ".")
  31.  
  32.     // fmt.Print("You are ", firstName, " ", lastName, ", a ", age, "-years old person from ", town, ".\n")
  33.    
  34.     // fmt.Printf("You are %s %s, a %s-years old person from %s.", firstName, lastName, age, town)
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement