Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homego #6

Open
wants to merge 10 commits into
base: home
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion work-1.go → Lesson-1/work-1.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import "fmt"

func main() {
fmt.Println("Hello World!")
}

}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

предыдущих ДЗ в ДЗ3 не должно быть

28 changes: 28 additions & 0 deletions Lesson-2/work-1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"fmt"
"os"
)

func main() {
var err error
var a, b float64

fmt.Println("Введите значение высоты: ")
_, err = fmt.Scanln(&a)
if err != nil {
fmt.Println("Ошибка!" , err.Error())
os.Exit(1)
}

fmt.Println("Введите значение ширины: ")
_, err = fmt.Scanln(&b)
if err != nil {
fmt.Println("Ошибка! Неверный ввод.", err.Error())
os.Exit(1)
}

fmt.Printf("Площадь прямоугольника равна: %f\n", a*b)

}
22 changes: 22 additions & 0 deletions Lesson-2/work-2.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package main

import (
"fmt"
"math"
"os"
)

func main() {
var err error
fmt.Println("Введите значение площади круга")
var s float64
_, err = fmt.Scanln(&s)
if err != nil {
fmt.Println("Ошибка !!", err.Error())
os.Exit(1)
}
resultD := math.Sqrt(s/math.Pi) * 2 //формула вычисления площади круга D=√S/Пи

fmt.Printf("Площадь круга равна: %f\n", resultD)

}
23 changes: 23 additions & 0 deletions Lesson-2/work-3.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import (
"fmt"
"os"
)

func main() {
fmt.Println("Введите трехзначное число")
var numbers string
_, err := fmt.Scanln(&numbers)
if err != nil {
fmt.Println("Ошибка !!", err.Error())
os.Exit(1)
}
if len(numbers) == 3 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

хороший вариант, но попробуйте через число сделать :)

fmt.Println("Сотни: ", string(numbers[0]))
fmt.Println("Десятки: ", string(numbers[1]))
fmt.Println("Еденицы: ", string(numbers[2]))
} else {
fmt.Println("Ошибка!!! Введите трехзначное число")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

эту ошибку лучше обработать выше

}
}
7 changes: 0 additions & 7 deletions hello.go

This file was deleted.