Цитата:
Сообщение от МишаняИАТ
Нарооод нужно завтра сдать, не дайте чтоб в армию забрали=) что-то не охото пока что туда)
|
Ладно, живи пока.
Код:
VAR
prime:Word;
Function Next_Prime(p:Word):Word;
var
i:Integer;
b:boolean;
px:Word;
begin
px:=p;
Repeat
b:=true;
Inc(px);
for i:=(px div 2) downto 2 do
if (px mod i)=0 then b:=false;
Until b;
Next_Prime:=px;
end;
BEGIN
Write('Enter the prime number: ');
ReadLn(prime);
WriteLn('Next prime number is ',Next_Prime(prime));
ReadLn;
END.