Advertisement
MadCortez

Untitled

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