Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Palindrome-dates/FreeBASIC/palindrome-dates.basic
Normal file
28
Task/Palindrome-dates/FreeBASIC/palindrome-dates.basic
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Dim As String dateTest = ""
|
||||
Dim As Integer Pal =0, total = 0
|
||||
Print "Siguientes 15 fechas palindr¢micas al 2020-02-02:"
|
||||
For anno As Integer = 2021 To 9999
|
||||
dateTest = Ltrim(Str(anno))
|
||||
For mes As Integer = 1 To 12
|
||||
If mes < 10 Then dateTest = dateTest + "0"
|
||||
dateTest += Ltrim(Str(mes))
|
||||
For dia As Integer = 1 To 31
|
||||
If mes = 2 And dia > 28 Then Exit For
|
||||
If (mes = 4 Or mes = 6 Or mes = 9 Or mes = 11) And dia > 30 Then Exit For
|
||||
If dia < 10 Then dateTest += "0"
|
||||
dateTest = dateTest + Ltrim(Str(dia))
|
||||
For Pal = 1 To 4
|
||||
If Mid(dateTest, Pal, 1) <> Mid(dateTest, 9 - Pal, 1) Then Exit For
|
||||
Next Pal
|
||||
If Pal = 5 Then
|
||||
total += 1
|
||||
If total <= 15 Then Print Left(dateTest,4);"-";Mid(dateTest,5,2);"-";Right(dateTest,2)
|
||||
End If
|
||||
if total > 15 then Exit For : Exit For : Exit For
|
||||
dateTest = Left(dateTest, 6)
|
||||
Next dia
|
||||
dateTest = Left(dateTest, 4)
|
||||
Next mes
|
||||
dateTest = ""
|
||||
Next anno
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue