Giter Club home page Giter Club logo

Comments (27)

diegoparra avatar diegoparra commented on August 22, 2024

https://play.golang.org/p/7oiWZLQydBP

from aprendago.

haystem avatar haystem commented on August 22, 2024

Inclui um a mais

package main

import("fmt")

func main(){
  x:=13878493
  fmt.Printf("O valor de %v em binário é: %b \n",x,x)
  fmt.Printf("O valor de %v em decimal é: %d \n",x,x)
  fmt.Printf("O valor de %v em octagonal é: %o \n",x,x)
  fmt.Printf("O valor de %v em hexadecimal é: %x \n",x,x)
  
}

from aprendago.

guifeliper avatar guifeliper commented on August 22, 2024

Eu tinha esquecido o do hexadecimal de cabeça tive que dar uma recapitulada.

package main

import (
	"fmt"
)

func main() {
	x := 100
	fmt.Printf("Decimal: %d \n Binário %b \n hexadecimal %#x", x, x, x)
}

from aprendago.

Julian-ie avatar Julian-ie commented on August 22, 2024

https://play.golang.org/p/Gfte4IH4iSn

from aprendago.

thiagoalgo avatar thiagoalgo commented on August 22, 2024

https://play.golang.org/p/W7BoaNZkQSp

from aprendago.

viniciussanchez avatar viniciussanchez commented on August 22, 2024

https://play.golang.org/p/qPcryPp4hzn

from aprendago.

tomxdev avatar tomxdev commented on August 22, 2024

package main

import "fmt"

func main() {

x := 100
fmt.Printf("DECIMAL: %d, BINARY: %b, HEXADECIMAL: %#x", x , x, x)

}

from aprendago.

victorinno avatar victorinno commented on August 22, 2024

https://play.golang.org/p/FXZ8k5IKGKR

from aprendago.

ygorsimoes avatar ygorsimoes commented on August 22, 2024
package main

import (
	"fmt"
	"os"
)

func main() {
	numero := 10
	fmt.Print("Insira alguma coisa: ")

	// Entrada de dados
	numero, err := fmt.Scan(&numero)

	//Trata o possível erro da entrada de dados
	if err != nil {
		// Sai do programa com o status diferente de 0
		os.Exit(-1)
	}

	// Imprime a variável em Decimal, Binário e Hexadecimal
	fmt.Printf("\nDecimal: %d \nBinário: %b \nHexadecimal: %#x", numero, numero, numero)
}

Output:

Decimal: 10 
Binário: 1010 
Hexadecimal: 0xa

from aprendago.

JPauloMoura avatar JPauloMoura commented on August 22, 2024

Resolução do Exercício

from aprendago.

Lucasmirandar avatar Lucasmirandar commented on August 22, 2024

https://play.golang.org/p/qAzbTeQJS7C

from aprendago.

avlambertucci avatar avlambertucci commented on August 22, 2024

https://play.golang.org/p/OfaeTlS3-V1

from aprendago.

isonux avatar isonux commented on August 22, 2024

package main

import (
"fmt"
)

var num = 1024

func main() {
// Sinceramente eu não havia lembrado do '#' no numero hexa
// essa eh a v2 no meu programa
fmt.Printf("%d\n%b\n%#x", num, num, num)
}

from aprendago.

andersoncleyson avatar andersoncleyson commented on August 22, 2024
package main

import (
    "fmt"

)


func main(){

    fmt.Println("Decimal\tBinário\tHexa\tCaractere")
    for i := 33; i <= 126; i++{
        fmt.Printf("  %d \t%b\t%#x\t    %c\n", i, i, i, i)
    }

}

from aprendago.

guilherme-de-marchi avatar guilherme-de-marchi commented on August 22, 2024
package main

import "fmt"

func main() {

	var value int
	fmt.Print("Valor: ")
	fmt.Scan(&value)

	fmt.Printf("\nDecimal:     %d\n", value)
	fmt.Printf("Hexadecimal: %x\n", value)
	fmt.Printf("Binário:     %b\n", value)
	fmt.Printf("Octagonal:   %o\n", value)

}

Output:

Valor: 10

Decimal:     10
Hexadecimal: 0xa
Binário:     0b1010
Octagonal:   012

from aprendago.

ltbatis avatar ltbatis commented on August 22, 2024

https://play.golang.org/p/NLLqbG1RVbE

from aprendago.

CarlosSMA avatar CarlosSMA commented on August 22, 2024
package main

import (
	"fmt"
)

func main() {
	a := 404
	fmt.Printf("Binário - %b \nDecimal - %d \nHexadecimal - %#x\n", a, a, a)
}

Output

Binário - 110010100 
Decimal - 404 
Hexadecimal - 0x194

from aprendago.

AlissonAp avatar AlissonAp commented on August 22, 2024

https://go.dev/play/p/9DDPTbThL2q

from aprendago.

gustavomfc avatar gustavomfc commented on August 22, 2024

package main

import "fmt"

func main() {
n := 42

fmt.Printf("%v em Decimal = %d\n", n, n)
fmt.Printf("%v em Binário = %b\n", n, n)
fmt.Printf("%v em Hexa = %x\n", n, n)

}

from aprendago.

M3L1M avatar M3L1M commented on August 22, 2024

a:=100 fmt.Printf("%d\t%#x\t%b", a, a, a)

from aprendago.

adelsonsljunior avatar adelsonsljunior commented on August 22, 2024
package main

import (
	"fmt"
)

func main() {

	a := 13

	fmt.Printf("Decimal: %d", a)
	fmt.Printf("\nBinároo: %b", a)
	fmt.Printf("\nDecimal: %#x", a)
}

from aprendago.

an4kein avatar an4kein commented on August 22, 2024
https://go.dev/play/p/XbCuFR5ZMHu

// You can edit this code!
// Click here and start typing.
package main

// https://go.dev/play/p/MslHxAYgayM
import "fmt"

func main() {
	x := 100
	fmt.Printf("%d\n%#b\n%#x", x, x, x)
}

/*
- Escreva um programa que mostre um número em decimal, binário, e hexadecimal.
*/
---------------------------------------------------------------------------------------------------------------------------------------------
100
0b1100100
0x64
Program exited.
---------------------------------------------------------------------------------------------------------------------------------------------

from aprendago.

Gabrielfrahm avatar Gabrielfrahm commented on August 22, 2024
package main

import "fmt"

var n = 10

func main() {
	fmt.Printf("%d, %#b, %#x", n, n, n)
}

from aprendago.

mrercj avatar mrercj commented on August 22, 2024

https://goplay.tools/snippet/ygKZ_bmccX7

image

from aprendago.

1r4mos avatar 1r4mos commented on August 22, 2024

https://go.dev/play/p/UgLuT4EG2zz

from aprendago.

DominMFD avatar DominMFD commented on August 22, 2024

https://go.dev/play/p/RBTYQHsH_Wl

from aprendago.

Vitor-Zen avatar Vitor-Zen commented on August 22, 2024

https://go.dev/play/p/vZVGPtGtwgB

from aprendago.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.