Here's a sample code to perform subtraction of two numbers in Go:
main.go276 chars18 lines
In this code, we define three variables num1
, num2
, and result
. We then use the fmt.Scanln()
function to read in the values for num1
and num2
. We then perform the subtraction operation using the -
operator and store the result in the result
variable. Finally, we print the result in the desired format using fmt.Printf()
.
gistlibby LogSnag