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.
bool f(int x, int y, int z){
if(pow(double(x),2)+pow(double(y),2)==pow(double(z),2)){
return true;
}
else
{
return false;
}
}