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