BSD 1 development
[unix-history] / tests / palindromes.p
CommitLineData
fde98a2d
BJ
1program palindromes(output);
2 var i,j,l,n,r,s: integer;
3 p: boolean;
4 d: array [1..10] of integer;
5begin n := 0; writeln(clock);
6 repeat n := n+1; s := n*n; l := 0;
7 repeat l := l+1; r := s div 10;
8 d[l] := s - 10*r; s := r
9 until s = 0;
10 i := 1; j := l;
11 repeat p := d[i]=d[j];
12 i := i+1; j := j-1
13 until (i>=j) or not p;
14 if p then writeln(n,n*n)
15 until n = 10000;
16 writeln(clock)
17end .