Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program rabotaet;
- var
- i, n, coren: integer;
- Flag, FlagProstoe: Boolean;
- s: String;
- begin
- for n := 1000 to 9999 do
- begin
- str(n, s);
- if (s[1] = s[2]) and (s[3] = s[4]) then
- begin
- Flag := False;
- coren := trunc(sqrt(n));
- for i := 2 to coren do
- if n mod i = 0 then
- begin
- Flag := True;
- break;
- end;
- if not(Flag) then
- begin
- Writeln('Prostoe ', n);
- FlagProstoe := True;
- end;
- end;
- end;
- if not(FlagProstoe) then
- Writeln('No solution');
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement