30 lines
918 B
Plaintext
30 lines
918 B
Plaintext
dateTest = ""
|
|
mes = 0 : dia = 0 : anno = 0 : Pal = 0
|
|
total = 0
|
|
print "Siguientes 15 fechas palindrómicas al 2020-02-02:"
|
|
for anno = 2021 to 9999
|
|
dateTest = ltrim(string(anno))
|
|
for mes = 1 to 12
|
|
if mes < 10 then dateTest = dateTest + "0"
|
|
dateTest = dateTest + ltrim(string(mes))
|
|
for dia = 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 = dateTest + "0"
|
|
dateTest = dateTest + ltrim(string(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
|
|
end
|