PHP5 Source Code
<?php
// Author: Hannes du Plooy
// Date: 8 October 2013
// Objective: To solve the following
// ONE
// ONE
// ONE
// +ONE
// ----
// TEN
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;
}
print "Answer is \n\n";
print " " . $O . $N . $E . "\n";
print " " . $O . $N . $E . "\n";
print " " . $O . $N . $E . "\n";
print "+" . $O . $N . $E . "\n";
print "----\n";
print " " . $T . $E . $N . "\n";
exit;
}
}
}
?>