var
i, si, N, ss: Integer;
s: string;
begin
Write ('Введите N: ');
ReadLn (N);
s := IntToStr (N);
ss := 0;
for i := 1 to Length (s) do begin
si := StrToInt (s [i]);
if si mod 4 <> 0 then
ss := ss + si;
end;
Writeln ('Сумма цифр = ' + IntToStr (ss));
end.
// второй вариант решения
var
si, N, ss: Integer;
begin
Write ('Введите N: ');
ReadLn (N);
ss := 0;
while N > 0 do begin
si := N mod 10;
N := N div 10;
if si mod 4 <> 0 then
ss := ss + si;
end;
Writeln ('Сумма цифр = ' + IntToStr (ss));
end.
var
i, si, N, ss: Integer;
s: string;
begin
Write ('Введите N: ');
ReadLn (N);
s := IntToStr (N);
ss := 0;
for i := 1 to Length (s) do begin
si := StrToInt (s [i]);
if si mod 4 <> 0 then
ss := ss + si;
end;
Writeln ('Сумма цифр = ' + IntToStr (ss));
end.
// второй вариант решения
var
si, N, ss: Integer;
begin
Write ('Введите N: ');
ReadLn (N);
ss := 0;
while N > 0 do begin
si := N mod 10;
N := N div 10;
if si mod 4 <> 0 then
ss := ss + si;
end;
Writeln ('Сумма цифр = ' + IntToStr (ss));
end.
A,S,k:longint;
Begin
k:=0;
Read(A);
While A<>0 do
Begin
S:=0;
A:=Abs(A);
While A > 0 do
Begin
S:=S+A mod 10;
A:=A div 10;
End;
if S=10 then k:=k+1;
Read(A);
End;
WriteLn('Искомое количество: ',k);
End.