Minimum multiple of m where digital sum equals m: Difference between revisions

Added various BASIC dialects (Chipmunk Basic, Gambas and XBasic)
(Added various BASIC dialects (Chipmunk Basic, Gambas and XBasic))
Line 161:
<pre>Same as FreeBASIC entry.</pre>
 
==={{header|Chipmunk Basic}}===
{{works with|Chipmunk Basic|3.6.4}}
</syntaxhighlight lang="vbnet">100 cls
110 c = 0
120 n = 1
130 while c < 70
140 m = 1
150 while 1
160 nm = n*m
170 t = 0
180 while nm
190 t = t + nm mod 10
200 nm = floor(nm / 10)
210 wend
220 if t = n then exit while
230 m = m +1
240 wend
260 c = c +1
270 print using "########"; m;
280 if c mod 10 = 0 then print
290 n = n +1
300 wend
310 end</syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
==={{header|FreeBASIC}}===
{{trans|Phix}}
Line 182 ⟶ 207:
n += 1
Loop
Sleep</syntaxhighlight>
</syntaxhighlight>
{{out}}
<pre> 1 1 1 1 1 1 1 1 1 19
Line 192 ⟶ 216:
17449 38269 56413 37037 1108909 142498 103507 154981 150661 1333333
163918 322579 315873 937342 1076923 1030303 880597 1469116 1157971 12842857</pre>
 
==={{header|Gambas}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="vbnet">Public Sub Main()
Dim c As Integer = 0, n As Integer = 1
 
Do While c < 70
Dim m As Integer = 1
Do
Dim nm As Integer = n * m, t As Integer = 0
While nm
t += nm Mod 10
nm = Floor(nm / 10)
Wend
If t = n Then Break
m += 1
Loop
c += 1
Print Format(m, "######## ");
If c Mod 10 = 0 Then Print
n += 1
Loop
 
End</syntaxhighlight>
 
==={{header|PureBasic}}===
Line 229 ⟶ 278:
{{out}}
<pre>Same as FreeBASIC entry.</pre>
 
==={{header|XBasic}}===
{{works with|Windows XBasic}}
<syntaxhighlight lang="qbasic">PROGRAM "program name"
VERSION "0.0000"
 
DECLARE FUNCTION Entry ()
 
FUNCTION Entry ()
c = 0
n = 1
DO WHILE c < 70
m = 1
DO WHILE 1
nm = n * m
t = 0
DO WHILE nm
t = t + nm MOD 10
nm = INT((nm / 10)+.5)
LOOP
IF t = n THEN EXIT DO
INC m
LOOP
INC c
PRINT FORMAT$("######## ", m);
IF c MOD 10 = 0 THEN PRINT
INC n
LOOP
END FUNCTION
END PROGRAM</syntaxhighlight>
 
==={{header|Yabasic}}===
2,169

edits