var x, a, b, i, c: integer;
begin
readln(x);
a:= 0; b:= 0; i:=0;
while x > 0 do begin
i:= i + 1;
c:= x mod 10;
if i mod 2 = 0 then a:= a + c
else b:= b + c;
x:= x div 10;
end;
writeln(a);
writeln(b);
end.
|
int х, a, b, i, c;
scanf("%d", &х);
a=0; b=0; i=0;
while (x>0)
{
i=i+1;
c=x%10;
if (i%2==0)
a=a+c;
else
b=b+c;
x=x/10;
}
printf("%d\n%d", a,b);
|