Advertisement
Mushi

aritimeticos.go

Apr 24th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.65 KB | None | 0 0
  1. // aritimeticos aritimeticos.go
  2. package main
  3.  
  4. import (
  5.     "fmt"
  6.     "math"
  7. )
  8.  
  9. func main() {
  10.     a := 3
  11.     b := 2
  12.  
  13.     fmt.Println("Soma =>", a+b)
  14.     fmt.Println("Subtração =>", a-b)
  15.     fmt.Println("Divisão =>", a/b)
  16.     fmt.Println("Multiplicação =>", a*b)
  17.     fmt.Println("Módulo =>", a%b)
  18.  
  19.     // bitwise
  20.     fmt.Println("E =>", a&b)   // 11 & 10 = 10
  21.     fmt.Println("Ou  =>", a|b) // 11 | 10 = 11
  22.     fmt.Println("Xor =>", a^b) // 11 ^ 10 = 01
  23.  
  24.     c := 3.0
  25.     d := 2.0
  26.  
  27.     // outras operacoes usando math...
  28.     fmt.Println("Maior =>", math.Max(float64(a), float64(b)))
  29.     fmt.Println("Menor =>", math.Min(c, d))
  30.     fmt.Println("Exponenciaçâo =>", math.Pow(c, d))
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement