...
This commit is contained in:
parent
051504d65b
commit
0457928c3e
295 changed files with 3588 additions and 3 deletions
15
Task/Arithmetic-Integer/Go/arithmetic-integer.go
Normal file
15
Task/Arithmetic-Integer/Go/arithmetic-integer.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var a, b int
|
||||
fmt.Print("enter two integers: ")
|
||||
fmt.Scanln(&a, &b)
|
||||
fmt.Printf("%d + %d = %d\n", a, b, a+b)
|
||||
fmt.Printf("%d - %d = %d\n", a, b, a-b)
|
||||
fmt.Printf("%d * %d = %d\n", a, b, a*b)
|
||||
fmt.Printf("%d / %d = %d\n", a, b, a/b) // truncates towards 0
|
||||
fmt.Printf("%d %% %d = %d\n", a, b, a%b) // same sign as first operand
|
||||
// no exponentiation operator
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue