Advertisement
MadCortez

Untitled

Dec 8th, 2020
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.59 KB | None | 0 0
  1. program rabotaet;
  2.  
  3. var
  4.    i, n, coren: integer;
  5.    Flag: Boolean;
  6.    s: String;
  7.  
  8. begin
  9.    for n := 1000 to 9999 do
  10.    begin
  11.       str(n, s);
  12.       if (s[1] = s[2]) and (s[3] = s[4]) then
  13.       begin
  14.          Flag := False;
  15.          coren := trunc(sqrt(n));
  16.          for i := 2 to coren do
  17.             if n mod i = 0 then
  18.             begin
  19.                Flag := True;
  20.                break;
  21.             end;
  22.          if not(Flag) then
  23.             Writeln('Простое ', n)
  24.          else
  25.             Writeln('Не простое ', n);
  26.       end;
  27.    end;
  28.    Readln;
  29. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement