Happy numbers: Difference between revisions
→{{header|ALGOL W}}: another tweak
(→{{header|ALGOL W}}: tweak) |
(→{{header|ALGOL W}}: another tweak) |
||
Line 476:
% containing 4 (see the Wikipedia article) - the Algol 68 sample %
% also uses this %
integer v, dSum, d;
v
while begin
dSum := 0;
while v not = 0 do begin
d := v rem 10;
v := v div 10;
dSum := dSum + ( d * d )
end while_v_ne_0 ;
end do begin end
end if_v_ne_0 ;
end isHappy ;
begin % find the first 8 happy numbers %
|