Palindrome dates: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: syntax coloured) |
(Added XPL0 example.) |
||
Line 2,398: | Line 2,398: | ||
</pre> |
</pre> |
||
=={{header|XPL0}}== |
|||
<lang XPL0>func Rev(N); |
|||
int N; |
|||
[N:= N/10; |
|||
return rem(0)*10 + N; |
|||
]; |
|||
proc NumOut(N); |
|||
int N; |
|||
[if N < 10 then ChOut(0, ^0); |
|||
IntOut(0, N); |
|||
]; |
|||
int C, Y, M, D, Q, R; |
|||
[C:= 0; |
|||
for Y:= 2021 to -1>>1 do |
|||
for M:= 1 to 12 do |
|||
for D:= 1 to 28 do |
|||
[Q:= Y/100; |
|||
R:= rem(0); |
|||
if Q = Rev(D) and R = Rev(M) then |
|||
[IntOut(0, Y); ChOut(0, ^-); |
|||
NumOut(M); ChOut(0, ^-); |
|||
NumOut(D); CrLf(0); |
|||
C:= C+1; |
|||
if C >= 15 then return; |
|||
]; |
|||
]; |
|||
]</lang> |
|||
{{out}} |
|||
<pre> |
|||
2021-12-02 |
|||
2030-03-02 |
|||
2040-04-02 |
|||
2050-05-02 |
|||
2060-06-02 |
|||
2070-07-02 |
|||
2080-08-02 |
|||
2090-09-02 |
|||
2101-10-12 |
|||
2110-01-12 |
|||
2111-11-12 |
|||
2120-02-12 |
|||
2121-12-12 |
|||
2130-03-12 |
|||
2140-04-12 |
|||
</pre> |
|||
=={{header|Yabasic}}== |
=={{header|Yabasic}}== |