Sum and product puzzle: Difference between revisions

Content added Content deleted
m (→‎version 5, fast: simplified some code, split a long line, optimized search.)
m (→‎version 5, fast: added a message if there wasn't a solution found.)
Line 2,766: Line 2,766:
if C2(m * (s-m)) then do; if $>0 then iterate s; $= m; end
if C2(m * (s-m)) then do; if $>0 then iterate s; $= m; end
end /*m*/
end /*m*/
if $>0 then say "The numbers are: " $ " and " s-$
if $>0 then say 'The numbers are: ' $ " and " s-$
end /*s*/
end /*s*/
if $==0 then say 'No solution found.'
exit 0 /*stick a fork in it, we're all done. */
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
/*──────────────────────────────────────────────────────────────────────────────────────*/