Upside-down numbers: Difference between revisions

Content added Content deleted
(add freebasic)
Line 177: Line 177:
500000000TH: 1436368345672474769
500000000TH: 1436368345672474769
5E+09TH: ?OVERFLOW</pre>
5E+09TH: ?OVERFLOW</pre>

==={{header|FreeBASIC}}===
<syntaxhighlight lang="freebasic">
function is_ups( n as uinteger ) as boolean
dim as string m = str(n)
dim as uinteger lm = len(m), i
for i = 1 to int(lm/2.0+0.5)
if val(mid(m,i,1)) + val(mid(m,lm-i+1,1)) <> 10 then return false
next i
return true
end function

dim as uinteger count, n=0

while count<5000001
if is_ups(n) then
count = count + 1
if count < 51 then
print n,
if count mod 5 = 0 then print
end if
if count = 500 or count = 5000 then
print n
end if
end if
n = n + 1
wend
</syntaxhighlight>
<pre>
5 19 28 37 46
55 64 73 82 91
159 258 357 456 555
654 753 852 951 1199
1289 1379 1469 1559 1649
1739 1829 1919 2198 2288
2378 2468 2558 2648 2738
2828 2918 3197 3287 3377
3467 3557 3647 3737 3827
3917 4196 4286 4376 4466
494616
56546545
</pre>

=={{header|Go}}==
=={{header|Go}}==
{{trans|Python}}
{{trans|Python}}