vkorbes / aprendago

Curso completo em português da linguagem Go, de zero a ninja! 🇧🇷
http://aprendago.com
1k stars 179 forks source link

Exercício: Capítulo 7, Exercício 5 (Nível: 3) #21

Open vkorbes opened 3 years ago

vkorbes commented 3 years ago

Exercício: Capítulo 7, Exercício 5 (Nível: 3)

Link para o vídeo:

Use esta thread para compartilhar sua solução, discutir o exercício com os colegas e pedir ajuda caso tenha dificuldades!

diegoparra commented 3 years ago

https://play.golang.org/p/-UKWtiqnWl4

andersoncleyson commented 3 years ago

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

thiagoalgo commented 3 years ago

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

viniciussanchez commented 3 years ago

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

tomxdev commented 3 years ago
package main

import "fmt"

func main() {

    for i := 10; i <= 100;  i++{
        resp := i % 4
        fmt.Println(resp)
    }
}
an4kein commented 3 years ago

Tbm percebi um determinado padrao :)

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

ref:

ygorsimoes commented 3 years ago
package main

import "fmt"

func main() {

    // Loop que começa em 10 e termina em 100
    for i := 10; i <= 100; i++ {

        // Imprime o resto da divisão por 4
        fmt.Println(i % 4)
    }
}

Output:

2
3
0
1
2
3
0
1
...
3
0
1
2
3
0
1
2
3
0
JPauloMoura commented 3 years ago
package main

//Demonstre o resto da divisão por 4 de todos os números entre 10 e 100
import "fmt"

func main() {
    for inicio := 10; inicio <= 100; inicio++ {
        fmt.Printf("%d/4 resta: %v\n", inicio, (inicio % 4))
    }
}

Resolução do Exercício

Lucasmirandar commented 3 years ago

package main

import "fmt"

func main() { for x := 10; x <= 100; x++ { fmt.Println(x % 4) } }

andersoncleyson commented 2 years ago
package main

import "fmt"

func main(){
    for i := 10; i <= 100; i++{
        x := i % 4
        fmt.Printf("%d\n", x)
    }
}
CarlosSMA commented 2 years ago
package main

import (
    "fmt"
)

func main() {
    for i := 10; i <= 100; i++ {
        resto := i % 4
        fmt.Println("O resto de", i, "por 4 é", resto)
    }
}

Saída

O resto de 10 por 4 é 2
O resto de 11 por 4 é 3
O resto de 12 por 4 é 0
O resto de 13 por 4 é 1
O resto de 14 por 4 é 2
[...]
CaueFarias commented 2 years ago

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

wfrsilva commented 2 years ago

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

image

M3L1M commented 1 year ago

for i := 10; i <= 100; i++ { fmt.Println(i % 4) }

adelsonsljunior commented 1 year ago
package main

import (
    "fmt"
)

func main() {

    for i := 10; i <= 100; i++ {
        resto := i % 4
        fmt.Println(resto)
    }
}
DominMFD commented 2 months ago

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

Vitor-Zen commented 4 weeks ago

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