Last active
February 12, 2017 19:42
-
-
Save artivnv/56297ecf085d9c58e9049814d4ebe9dc to your computer and use it in GitHub Desktop.
This file contains 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" | |
func main() { | |
var name string | |
var namef string | |
var age int | |
var ok string | |
fmt.Print("Введите имя: ") | |
fmt.Scanln(&name) | |
fmt.Print("Введите фамилию: ") | |
fmt.Scanln(&namef) | |
fmt.Print("Введите ваш год рождения: ") | |
fmt.Scanln(&age) | |
age1 := 2017 - age | |
if age1 > 100 { | |
fmt.Println(" Я не умею считать числа больше 100 ") | |
} else { | |
var a int | |
a = age1 % 10 | |
if a == 1 { | |
ok = "год" | |
} | |
if a == 0 { | |
ok = "лет" | |
} | |
if a >= 2 { | |
if a <= 4 { | |
ok = "года" | |
} | |
} | |
if a >= 5 { | |
ok = "лет" | |
} | |
if age1 >= 11 { | |
if age1 <= 20 { | |
ok = "лет" | |
} | |
} | |
if age > 2017 { | |
fmt.Println("Вы ввели неправильную дату") | |
} else { | |
fmt.Println("Привет,", name, namef, ". Вам примерно", age1, ok) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment