Last active
May 26, 2022 17:16
-
-
Save r3code/36885dfc52717a93c661c327a5b6d6af to your computer and use it in GitHub Desktop.
Go Kids Training
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func main() { | |
var in string := "ACBBBCAACBBAAAC" | |
// 1. Определить длину строки in | |
// 2. Вывести на экран определенную длину строки | |
println( ) | |
// 3. Определить количество повторений букв A,B,C | |
for i := 0; i < ; i++ { | |
s := in[i] | |
} | |
// 4. Вывести на экран количество букв A в строке in | |
// 5. Вывести на экран количество букв B в строке in | |
// 6. Вывести на экран количество букв C в строке in | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func main() { | |
// Вывести на экран прямоугольник размером N на M при помощи значков * | |
N := 10 | |
M := 20 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func main() { | |
// 1. Отсортировать массив по возрастанию чисел | |
arr := [...]int{7, -1, 2, 7, 0, 7, 2, -1, 5} | |
// ожидаемый результат: -1, -1, 0, 2, 2, 5, 7, 7, 7 | |
for i := 0; i < ; i++ { | |
for j := 0; j < ; j++ { | |
// применить метод перестановок | |
} | |
} | |
// 2. Вывести отсортированный массив через запятую | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
// Игра угадай число | |
func main() { | |
n := makeNumber() | |
// fmt.Println(n) | |
for { | |
var x int | |
fmt.Scanf("%d", &x) | |
if x > n { | |
} | |
if x < n { | |
} | |
if x == n { | |
break | |
} | |
} | |
} | |
func makeNumber() int { | |
rand.Seed(time.Now().UnixNano()) | |
min := 10 | |
max := 30 | |
return rand.Intn(max-min+1) + min | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment