Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Descending-primes/FreeBASIC/descending-primes.basic
Normal file
31
Task/Descending-primes/FreeBASIC/descending-primes.basic
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include "isprime.bas"
|
||||
#include "sort.bas"
|
||||
|
||||
Dim As Double t0 = Timer
|
||||
Dim As Integer i, n, tmp, num, cant
|
||||
Dim Shared As Integer matriz(512)
|
||||
For i = 0 To 511
|
||||
n = 0
|
||||
tmp = i
|
||||
num = 9
|
||||
While tmp
|
||||
If tmp And 1 Then n = n * 10 + num
|
||||
tmp = tmp Shr 1
|
||||
num -= 1
|
||||
Wend
|
||||
matriz(i) = n
|
||||
Next i
|
||||
|
||||
Sort(matriz())
|
||||
|
||||
cant = 0
|
||||
For i = 1 To Ubound(matriz)-1
|
||||
n = matriz(i)
|
||||
If IsPrime(n) Then
|
||||
Print Using "#########"; n;
|
||||
cant += 1
|
||||
If cant Mod 10 = 0 Then Print
|
||||
End If
|
||||
Next i
|
||||
Print Using !"\n\nThere are & descending primes."; cant
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue