JavaScript Source Code
// Author: Hannes du Plooy
// Date: 8 October 2013
// Objective: To solve the following
// ONE
// ONE
// ONE
// +ONE
// ----
// TEN
var O,E,N,T,tmp,carry;
var out = process.stdout;
for(O=1;O<10;O++) {
for(E=0;E<10;E++) {
if (O != E) {
tmp = E*4;
N = tmp % 10;
carry = (tmp-N)/10;
if (N == O || N == E)
continue;
tmp = carry + N*4;
E2 = tmp % 10;
carry = (tmp-E2)/10;
if (E2 != E)
continue;
T = carry + O*4;
if (T >= 10)
continue;
if (T == O || T == E || T == N)
continue;
out.write("Answer is \n\n");
out.write(" "+O+N+E+"\n");
out.write(" "+O+N+E+"\n");
out.write(" "+O+N+E+"\n");
out.write("+"+O+N+E+"\n");
out.write("----\n");
out.write(" " +T+E+N+"\n");
return;
}
}
}