C/C++ Source Code

/* Author: Hannes du Plooy */
/* Date: 8 October 2013    */
/* Objective: To solve the following */
/*  ONE  */
/*  ONE  */
/*  ONE  */
/* +ONE  */
/* ----  */
/*  TEN  */

#include 

int main(int argc, char *argv[]) {
    int O,E,N,T,E2;
    int carry,tmp;

    for(O=1;O<10;O++) {
        for(E=0;E<10;E++) {
            if (O != E) {
                tmp = E*4;
                carry = tmp/10;
                N = tmp % 10;
                if (N == O || N == E)
                    continue;
                tmp = carry + N*4;
                carry = tmp/10;
                E2 = tmp % 10;
                if (E2 != E)
                    continue;
                T = carry + O*4;
                if (T >= 10)
                    continue;
                if (T == O || T == E || T == N)
                    continue;
                printf("Answer is \n\n");
                printf(" %1d%1d%1d\n",O,N,E);
                printf(" %1d%1d%1d\n",O,N,E);
                printf(" %1d%1d%1d\n",O,N,E);
                printf("+%1d%1d%1d\n",O,N,E);
                printf("----\n");
                printf(" %1d%1d%1d\n",T,E,N);
                return 0;
            }
        }
    }
}