RosettaCodeData/Task/Iterated-digits-squaring/XPL0/iterated-digits-squaring.xpl0
2023-07-01 13:44:08 -04:00

16 lines
384 B
Text

int C, N, M, S;
[C:= 0;
for N:= 1 to 100_000_000-1 do
[M:= N;
loop [S:= 0;
repeat M:= M/10;
S:= S + rem(0)*rem(0);
until M = 0;
if S = 89 then
[C:= C+1; quit];
if S = 1 then quit;
M:= S;
];
];
IntOut(0, C);
]