Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var startNum, finalNum int
- fmt.Scanln(&startNum)
- fmt.Scanln(&finalNum)
- for a := startNum / 1000; a <= finalNum / 1000; a++ {
- for b := startNum / 100 % 10; b <= finalNum / 100 % 10; b++ {
- for c := startNum / 10 % 10; c <= finalNum / 10 % 10; c++ {
- for d := startNum % 10; d <= finalNum % 10; d++ {
- if a % 2 == 1 && b % 2 == 1 && c % 2 == 1 && d % 2 == 1 {
- fmt.Printf("%d%d%d%d ", a, b, c, d)
- }
- }
- }
- }
- }
- }
- ИЛИ:
- package main
- import "fmt"
- func main() {
- var startNum, finalNum string
- fmt.Scanln(&startNum)
- fmt.Scanln(&finalNum)
- for a := startNum[0]; a <= finalNum[0]; a++ {
- for b := startNum[1]; b <= finalNum[1]; b++ {
- for c := startNum[2]; c <= finalNum[2]; c++ {
- for d := startNum[3]; d <= finalNum[3]; d++ {
- if a % 2 == 1 && b % 2 == 1 && c % 2 == 1 && d % 2 == 1 {
- fmt.Printf("%c%c%c%c ", a, b, c, d)
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement