Sum of the digits of n is substring of n: Difference between revisions

Content added Content deleted
m (added whitespace and highlighting, added related tasks.)
(→‎{{header|ALGOL W}}: spell isContained properly...)
Line 261: Line 261:
else begin
else begin
integer tPower, v, u;
integer tPower, v, u;
logical isContaned;
logical isContained;
% find the lowest power of 10 that is greater then t %
% find the lowest power of 10 that is greater then t %
tPower := 10;
tPower := 10;
Line 269: Line 269:
v := v div 10
v := v div 10
end while_v_gt_9 ;
end while_v_gt_9 ;
isContaned := false;
isContained := false;
v := abs t;
v := abs t;
u := abs s;
u := abs s;
while not isContaned and u > 0 do begin
while not isContained and u > 0 do begin
isContaned := ( u rem tPower ) = v;
isContained := ( u rem tPower ) = v;
u := u div 10
u := u div 10
end while_not_isContaned_and_u_gt_0 ;
end while_not_isContained_and_u_gt_0 ;
isContaned
isContained
end containsDigits ;
end containsDigits ;
% find and show the matching numbers up to 1000 %
% find and show the matching numbers up to 1000 %