Go Source Code

/* Author: Hannes du Plooy */
/* Date: 5 June 2016       */
/* Objective: To solve the following */
/*  ONE  */
/*  ONE  */
/*  ONE  */
/* +ONE  */
/* ----  */
/*  TEN  */

package main

import "fmt"


func main() {
    var O, E, N, T, tmp, carry int
    
    for O = 1; O <= 10; O++ {
        for E = 0; E <= 10; E++ {
            if E != O {
                tmp = E*4
                carry = tmp/10
                N = tmp % 10
                if N != O && N != E {
                    tmp = carry + N*4
                    carry = tmp/10
                    E2 := tmp % 10
                    if E2 == E {
                        T = carry + O*4
                        if T < 10 && T != O && T != E && T != N {
                            fmt.Println("The result:")
                            fmt.Printf(" %d%d%d\n",O,N,E)
                            fmt.Printf("+%d%d%d\n",O,N,E)
                            fmt.Printf("+%d%d%d\n",O,N,E)
                            fmt.Println("----")
                            fmt.Printf(" %d%d%d\n",T,E,N)
                        }
                    }
                }
            }
        }
    }
}