Ответы
Ответ дал:
0
PascalABC.NET 3.4.2, сборка 1843 от 24.10.2018
function IsPrime(self: integer): boolean; extensionmethod;
begin
Result := true;
if self <= 1 then begin Result := false; exit; end;
for var i := 2 to floor(sqrt(self)) do
if self mod i = 0 then begin result := false; exit; end;
end;
begin
Println(ReadInteger.IsPrime ? 'Да' : 'Нет')
end.
Вас заинтересует
1 год назад
6 лет назад
6 лет назад
9 лет назад
9 лет назад
9 лет назад