SEND + MORE = MONEY: Difference between revisions
Content added Content deleted
(SEND + MORE = MONEY in FreeBasic) |
(SEND + MORE = MONEY in various basic dialects (BASIC256, Run Basic and Yabasic)) |
||
Line 51: | Line 51: | ||
9567 + 1085 = 10652 |
9567 + 1085 = 10652 |
||
</pre> |
</pre> |
||
=={{header|BASIC}}== |
|||
Rosetta Code problem: https://rosettacode.org/wiki/SEND_%2B_MORE_%3D_MONEY |
|||
by Jjuanhdez, 02/2023 |
|||
==={{header|BASIC256}}=== |
|||
{{trans|FreeBASIC}} |
|||
{{works with|Run BASIC}} |
|||
{{works with|Just BASIC}} |
|||
{{works with|Liberty BASIC}} |
|||
<syntaxhighlight lang="freebasic">m = 1 |
|||
for s = 8 to 9 |
|||
for e = 0 to 9 |
|||
if e <> m and e <> s then |
|||
for n = 0 to 9 |
|||
if n <> m and n <> s and n <> e then |
|||
for d = 0 to 9 |
|||
if d <> m and d <> s and d <> e and d <> n then |
|||
for o = 0 to 9 |
|||
if o <> m and o <> s and o <> e and o <> n and o <> d then |
|||
for r = 0 to 9 |
|||
if r <> m and r <> s and r <> e and r <> n and r <> d and r <> o then |
|||
for y = 0 to 9 |
|||
if y <> m and y <> s and y <> e and y <> n and y <> d and y <> o then |
|||
if ((1000*(s+m)) + (100*(e+o)) + (10*(n+r)) + (d+e)) = ((10000* m) + (1000*o) + (100*n) + (10*e) + y) then |
|||
print s;e;n;d; " + "; m;o;r;e; " = "; m;o;n;e;y |
|||
end if |
|||
end if |
|||
next y |
|||
end if |
|||
next r |
|||
end if |
|||
next o |
|||
end if |
|||
next d |
|||
end if |
|||
next n |
|||
end if |
|||
next e |
|||
next s</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Same as FreeBASIC entry.</pre> |
|||
==={{header|Yabasic}}=== |
|||
{{trans|FreeBASIC}} |
|||
<syntaxhighlight lang="yabasic">m = 1 |
|||
for s = 8 to 9 |
|||
for e = 0 to 9 |
|||
if e <> m and e <> s then |
|||
for n = 0 to 9 |
|||
if n <> m and n <> s and n <> e then |
|||
for d = 0 to 9 |
|||
if d <> m and d <> s and d <> e and d <> n then |
|||
for o = 0 to 9 |
|||
if o <> m and o <> s and o <> e and o <> n and o <> d then |
|||
for r = 0 to 9 |
|||
if r <> m and r <> s and r <> e and r <> n and r <> d and r <> o then |
|||
for y = 0 to 9 |
|||
if y <> m and y <> s and y <> e and y <> n and y <> d and y <> o then |
|||
if ((1000*(s+m)) + (100*(e+o)) + (10*(n+r)) + (d+e)) = ((10000* m) + (1000*o) + (100*n) + (10*e) + y) ? str$(s), str$(e), str$(n), str$(d), " + ", str$(m), str$(o), str$(r), str$(e), " = ", str$(m), str$(o), str$(n), str$(e), str$(y) |
|||
fi |
|||
next y |
|||
fi |
|||
next r |
|||
fi |
|||
next o |
|||
fi |
|||
next d |
|||
fi |
|||
next n |
|||
fi |
|||
next e |
|||
next s |
|||
end</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Same as FreeBASIC entry.</pre> |
|||
=={{header|FreeBASIC}}== |
=={{header|FreeBASIC}}== |