begin for i:=1000 to 9999 do begin d:= i mod 10; //4 c:= i div 10 mod 10; //3 b:= i div 100 mod 10; //2 a:= i div 1000; //1
if ((a=d) and (b=c)) then write (i:5); end; end.
2)
program example2;
var a,b,c,d,i:integer; h,j,k,l:boolean; begin write ('Введите четырехзначное число '); readln(i);
d:= i mod 10; //4 c:= i div 10 mod 10; //3 b:= i div 100 mod 10; //2 a:= i div 1000; //1 if (a<>0) and (a<>5) then write(a) else write(''); if (b<>0) and (b<>5) then write(b) else write(''); if (c<>0) and (c<>5) then write(c) else write(''); if (d<>0) and (d<>5) then write(d) else write('');
program raf105;
uses robot;
var l,d,r,u: boolean;
begin
task('if8');
l:= wallfromleft;
d:= wallfromdown;
r:= wallfromright;
u:= wallfromup;
if l
then begin right; paint; right; paint;
if freefromright
then begin right; paint; end
end;
if d
then begin up; paint; up; paint;
if freefromup
then begin up; paint; end
end;
if r
then begin left; paint; left; paint;
if freefromleft
then begin left; paint; end
end;
if u
then begin down; paint; down; paint;
if freefromdown
then begin down; paint; end
end;
end.
if9program raf105;
uses robot;
var l,r: boolean;
begin
task('if9');
right; r:= wallfromdown;
left;
left; l:= wallfromup;
right;
if r and l
then begin up; paint; down; down; paint; up; end
else paint;
end.
if10program raf105;
uses robot;
var l,r: boolean;
begin
task('if10');
right; r:= cellispainted;
left;
left; l:= cellispainted;
right;
if r or l
then begin up; paint; end
else paint;
end.
Две задачи по порядку)
1)
program example1;
var a,b,c,d,i:integer;
begin
for i:=1000 to 9999 do
begin
d:= i mod 10; //4
c:= i div 10 mod 10; //3
b:= i div 100 mod 10; //2
a:= i div 1000; //1
if ((a=d) and (b=c)) then write (i:5);
end;
end.
2)
program example2;
var a,b,c,d,i:integer;
h,j,k,l:boolean;
begin
write ('Введите четырехзначное число '); readln(i);
d:= i mod 10; //4
c:= i div 10 mod 10; //3
b:= i div 100 mod 10; //2
a:= i div 1000; //1
if (a<>0) and (a<>5) then write(a) else write('');
if (b<>0) and (b<>5) then write(b) else write('');
if (c<>0) and (c<>5) then write(c) else write('');
if (d<>0) and (d<>5) then write(d) else write('');
end.