program Znanija;
var s, a, p: integer;
begin
s := 0;
a := 23;
p := a;
while p>0 do
s:= s+p mod 10;
p:= p div 10;
end;
writeln(s);
end.
Output: 5.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
program Znanija;
var s, a, p: integer;
begin
s := 0;
a := 23;
p := a;
while p>0 do
begin
s:= s+p mod 10;
p:= p div 10;
end;
writeln(s);
end.
Output: 5.