Jump to content

Arithmetic/Integer: Difference between revisions

added Go
(added Go)
Line 451:
4 % 3 = 1
</lang>
 
=={{header|Go}}==
<lang go>import "fmt"
func arithmetic(a int, b int) {
fmt.Printf("a+b = %d\n", a+b)
fmt.Printf("a-b = %d\n", a-b)
fmt.Printf("a*b = %d\n", a*b)
fmt.Printf("a/b = %d\n", a/b) // truncates towards 0
fmt.Printf("a%%b = %d\n", a%b) // same sign as first operand
}</lang>
 
=={{header|Groovy}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.