Thursday, August 29, 2019

Arithmetic Operators Using Structures in Golang


Write a program that will ask the user to give two numbers and then the program will perform addition, subtraction, multiplication, division, and modulus using structures.

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 in 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.

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

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Sample Program Output


Program Listing

/* arithmetic.go
   Author   : Mr. Jake Rodriguez Pomperada, MAED-IT
   Date     : August 7, 2019   Wednesday  5:10 AM
   Location : Bacolod City, Negros Occidental
   Emails : jakerpomperada@gmail.com and jakerpomperada@yahoo.com
*/

package main

import "fmt"

type check_math struct {
a int32
    b int32
}

func main(){
var val check_math
var  sum,difference,product,quotient,modulus int32

fmt.Print("\n")
fmt.Print("\tArithmetic Operators Using Structures")
fmt.Print("\n\n")
fmt.Print("\tGive the First  Value   : ")
fmt.Scanln(&val.a)
fmt.Print("\tGive the Second Value   : ")
fmt.Scanln(&val.b)

// Perform arithmetic operations here
sum         = (val.a + val.b);
difference  = (val.a - val.b);
product     = (val.a * val.b);
quotient    = (val.a / val.b);
modulus     = (val.a % val.b);

fmt.Print("\n")
fmt.Print("\t===== DISPLAY RESULTS =====")
fmt.Print("\n\n")
fmt.Print("\tThe sum of ",val.a," and ",val.b, " is ",sum,"\n")
fmt.Print("\tThe difference between ",val.a," and ",val.b, " is ",difference,"\n")
fmt.Print("\tThe product of ",val.a," and ",val.b, " is ",product,"\n")
fmt.Print("\tThe quotient between ",val.a," and ",val.b, " is ",quotient,"\n")
fmt.Print("\tThe modulus value of ",val.a," and ",val.b, " is ",modulus,"\n")
fmt.Print("\n")
fmt.Print("\tEnd of Program")
fmt.Print("\n")
}
 

No comments:

Post a Comment