Given two numbers num1 and num2. The task is to write a GO program to find the addition of these two numbers.
Example: Below is the GO program to add two numbers
1 2 3 4 5 6 7 8 9 10 11 12 13 | package main import "fmt" func main() { var num1 int = 7 var num2 int = 8 var sum = num1 + num2 fmt.Print(sum) // Addition of two string } |
Example: Adding two number provided by user input
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | package main import "fmt" func main() { fmt.Print("Enter First String: ") //Print function is used to display output in same line var num1 int fmt.Scanln(&num1) // Take input from user fmt.Print("Enter Second String: ") var num2 int fmt.Scanln(&num2) var sum = num1 + num2 fmt.Print(sum) // Addition of two string } |