Thursday, March 18, 2021

Arithmetic Operators in Go

 A simple program to demonstrate how to use arithmetic operating using Go programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.




Program Listing

package main

import "fmt"

func main() {

    var x int = 31
    var y int = 20
    var z int

    z = x + y

    fmt.Printf("\n")
    fmt.Printf("\tArithmetic Operators in Go\n\n")
    fmt.Printf("\tLine 1 - Value of z is %d\n", z)

    z = x - y
    fmt.Printf("\tLine 2 - Value of z is %d\n", z)

    z = x * y
    fmt.Printf("\tLine 3 - Value of z is %d\n", z)

    z = x / y
    fmt.Printf("\tLine 4 - Value of z is %d\n", z)

    z = x % y
    fmt.Printf("\tLine 5 - Value of z is %d\n", z)

    x++
    fmt.Printf("\tLine 6 - Value of x is %d\n", x)

    x--
    fmt.Printf("\tLine 7 - Value of x is %d\n", x)
    fmt.Printf("\n")
    fmt.Printf("\tEnd of Program")
    fmt.Printf("\n")
}



No comments:

Post a Comment