var
s:string;
function CalsSum(s:string):integer;
i,r,sum,rr:integer;
begin
sum:=0;
for i:=1 to length(s) do
if (ord(s[i]) > 48) and (ord(s[i]) <= 57)
and (ord(s[i]) mod 2 = 1) then
val(s[i],rr,r);
sum:=sum+rr;
end;
CalsSum:=sum;
readln(s);
writeln(CalsSum(s));
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
var
s:string;
function CalsSum(s:string):integer;
var
i,r,sum,rr:integer;
begin
sum:=0;
for i:=1 to length(s) do
if (ord(s[i]) > 48) and (ord(s[i]) <= 57)
and (ord(s[i]) mod 2 = 1) then
begin
val(s[i],rr,r);
sum:=sum+rr;
end;
CalsSum:=sum;
end;
begin
readln(s);
writeln(CalsSum(s));
end.