Thursday, November 30, 2017

Addition of Two Numbers in Go

In this article I would like to share with you a sample program that will ask the user to give to numbers and then our program will compute the sum of two numbers using Go programming language. The code is very simple I just stated learning how to program using Go.

I am currently accepting programming work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Sample Program Output


Program Listing

add.go


// Addition of Two Numbers in Go 
// Written By Mr. Jake R. Pomperada
// November 30, 2017

package main
import "fmt"
func main(){
var a,b,sum int
fmt.Print("\n\n")
fmt.Print("Addition of Two Numbers")
fmt.Print("\n\n")
    fmt.Print("Enter first value  : ")
    fmt.Scanln(&a)
    fmt.Print("Enter second value  : ")
    fmt.Scanln(&b)

    sum = (a+b)
    
    fmt.Print("\n\n")
    fmt.Print("The sum of " ,a , " and " , b , " is ", sum, ".")
    fmt.Print("\n\n")
    fmt.Print("End of Program")
     fmt.Print("\n\n")
   
}



No comments:

Post a Comment