Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var startNum, endNum int
- fmt.Scanln(&startNum)
- fmt.Scanln(&endNum)
- for i := startNum; i <= endNum; i++ {
- var odd, even int
- var digit = i
- for x := 0; x < 6; x++ {
- if x % 2 == 0 {
- even += digit % 10
- } else {
- odd += digit % 10
- }
- digit /= 10
- }
- if odd == even {
- fmt.Printf("%d ", i)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement