Skip to content

Commit

Permalink
add new solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasPLopes committed Jul 11, 2022
1 parent f0dbdbe commit 6bf9b73
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 0 deletions.
35 changes: 35 additions & 0 deletions GO/1050.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import "fmt"

func main() {
var ddd int

fmt.Scan(&ddd)
fmt.Println(GetDDD(ddd))

}

func GetDDD(ddd int) string {

switch ddd {
case 61:
return "Brasilia"
case 71:
return "Salvador"
case 11:
return "Sao Paulo"
case 21:
return "Rio de Janeiro"
case 32:
return "Juiz de Fora"
case 19:
return "Campinas"
case 27:
return "Vitoria"
case 31:
return "Belo Horizonte"
default:
return "DDD nao cadastrado"
}
}
17 changes: 17 additions & 0 deletions GO/1060.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import "fmt"

func main() {
var entrada float64
positivos := 0

for i := 0; i < 6; i++ {
fmt.Scan(&entrada)
if entrada > 0 {
positivos++
}
}

fmt.Printf("%d valores positivos\n", positivos)
}
20 changes: 20 additions & 0 deletions GO/1064.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package main

import "fmt"

func main() {
var entrada, soma float64
positivos := 0

soma = 0.0
for i := 0; i < 6; i++ {
fmt.Scan(&entrada)
if entrada > 0 {
positivos++
soma += entrada
}
}

fmt.Printf("%d valores positivos\n", positivos)
fmt.Printf("%.1f\n", soma/float64(positivos))
}
18 changes: 18 additions & 0 deletions GO/1065.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import "fmt"

func main() {
var entrada int
pares := 0

for i := 0; i < 5; i++ {
fmt.Scan(&entrada)

if entrada%2 == 0 {
pares++
}
}

fmt.Printf("%d valores pares\n", pares)
}
18 changes: 18 additions & 0 deletions GO/1070.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import "fmt"

func main() {
var in int
fmt.Scan(&in)

if in%2 == 0 {
in++
}

fmt.Println(in)
for i := 0; i < 5; i++ {
in += 2
fmt.Println(in)
}
}
25 changes: 25 additions & 0 deletions GO/1071.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import (
"fmt"
)

func main() {
var x, y, soma int64
fmt.Scan(&x)
fmt.Scan(&y)

if x > y {
temp := x
x = y
y = temp
}
x++
for i := x; i < y; i++ {
if uint64(i)%2 == 1 {
soma += i
}
}

fmt.Println(soma)
}

0 comments on commit 6bf9b73

Please sign in to comment.