logo image

Go language program to Join two given strings

Views: 15

Following program shows you how to Join two given strings. In this program we get strings from user and join those strings

package main

import "fmt"

func main() {

  var string1 string
  var string2 string
  var output string
  fmt.Println("Please enter the first string:")
  fmt.Scanf("%s", &string1)
  fmt.Println("Please enter the second string:")
  fmt.Scanf("%s", &string2)
  output = string1 + string2
  fmt.Println("Joined string is: " , output)


Please enter the first string:
Please enter the second string:
Joined string is:  hellotom