Cullen and Woodall numbers: Difference between revisions
Content deleted Content added
mNo edit summary |
Cullen and Woodall numbers in various dialects BASIC (Gambas, Run BASIC and XBasic) |
||
Line 175:
=={{header|BASIC}}==
==={{header|BASIC256}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="basic256">print "First 20 Cullen numbers:"
Line 195:
end</syntaxhighlight>
{{out}}
<pre>Igual que la entrada de FreeBASIC.</pre>▼
▲Igual que la entrada de FreeBASIC.
==={{header|FreeBASIC}}===
<syntaxhighlight lang="
Print "First 20 Cullen numbers:"
Line 221 ⟶ 219:
First 20 Woodall numbers:
1 7 23 63 159 383 895 2047 4607 10239 22527 49151 106495 229375 491519 1048575 2228223 4718591 9961471 20971519</pre>
==={{header|Gambas}}===
<syntaxhighlight lang="vbnet">Public Sub Main()
Dim n, num As Integer
Print "First 20 Cullen numbers:"
For n = 1 To 20
num = n * (2 ^ n) + 1
Print num; " ";
Next
Print "\n\nFirst 20 Woodall numbers:"
For n = 1 To 20
num = n * (2 ^ n) - 1
Print num; " ";
Next
End </syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
==={{header|PureBasic}}===
Line 241 ⟶ 262:
CloseConsole()</syntaxhighlight>
{{out}}
<pre>Igual que la entrada de FreeBASIC.</pre>▼
▲Igual que la entrada de FreeBASIC.
==={{header|QBasic}}===
Line 268 ⟶ 287:
END</syntaxhighlight>
{{out}}
<pre>Igual que la entrada de FreeBASIC.</pre>▼
▲Igual que la entrada de FreeBASIC.
==={{header|Run BASIC}}===
{{works with|BASIC256}}
{{works with|Just BASIC}}
{{works with|Liberty BASIC}}
<syntaxhighlight lang="vb">print "First 20 Cullen numbers:"
for n = 1 to 20
num = n * (2^n)+1
print int(num); " ";
next
print : print
print "First 20 Woodall numbers:"
for n = 1 to 20
num = n * (2^n)-1
print int(num); " ";
next n
end</syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
==={{header|True BASIC}}===
Line 296 ⟶ 335:
Igual que la entrada de FreeBASIC.
</pre>
==={{header|XBasic}}===
{{works with|Windows XBasic}}
<syntaxhighlight lang="qbasic">PROGRAM "progname"
VERSION "0.0000"
IMPORT "xma"
DECLARE FUNCTION Entry ()
FUNCTION Entry ()
PRINT "First 20 Cullen numbers:"
FOR n = 1 TO 20
num! = n * POWER (2, n) + 1
PRINT num!;
NEXT n
PRINT
PRINT
PRINT "First 20 Woodall numbers:"
FOR n = 1 TO 20
num! = n * POWER (2, n) - 1
PRINT num!;
NEXT n
END FUNCTION
END PROGRAM</syntaxhighlight>
==={{header|Yabasic}}===
<syntaxhighlight lang="
for n = 1 to 20
Line 314 ⟶ 383:
end</syntaxhighlight>
{{out}}
<pre>Igual que la entrada de FreeBASIC.</pre>▼
▲Igual que la entrada de FreeBASIC.
|