Advertisement
MadCortez

Untitled

Dec 8th, 2020
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.65 KB | None | 0 0
  1. program rabotaet;
  2.  
  3. var
  4.    i, n, coren: integer;
  5.    Flag, FlagProstoe: 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.          begin
  24.             Writeln('Prostoe ', n);
  25.             FlagProstoe := True;
  26.          end;
  27.       end;
  28.    end;
  29.    if not(FlagProstoe) then
  30.       Writeln('No solution');
  31.    Readln;
  32. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement