Написать программу, выводящую на экран информацию по заданному образцу(Паскаль, через цикл for, попроще):
№ 1.
2 3 4 5 6 7 8 9
3 4 5 6 7 8 9 10
4 5 6 7 8 9 10 11
5 6 7 8 9 10 11 12
6 7 8 9 10 11 12 13
№ 2.
900000000
080000000
007000000
000500000
000040000
000003000
000000200
000000010
000000000
№ 3.
111111111
110000011
101000101
100101001
100010001
100101001
101000101
110000011
111111111
№ 4.
111111111
000000000
111111111
000000000
111111111
000000000
111111111
000000000
111111111
000000000
Ответы
№1
program raf105;
const
n1 = 5;
n2 = 8;
var
a: array[1..n1,1..n2] of integer;
i,j: integer;
begin
for i:=1 to n1 do
begin
writeln;
a[i,1]:= 1+i;
write(a[i,1]:2,' ');
for j:=2 to n2 do
begin
a[i,j]:= a[i,j-1]+1;
write(a[i,j]:2,' ');
end;
end;
end.
№2
program raf105;
const
n = 9;
var
a: array[1..n,1..n] of integer;
i,j: integer;
begin
for i:=1 to n do
begin
writeln;
for j:=1 to n do
begin
if j = i
then if i <= 3
then a[i,j]:= 10-j
else a[i,j]:= 10-j-1
else a[i,j]:= 0;
write(a[i,j],' ');
end;
end;
end.
№3
program raf105;
const
n = 9;
var
a: array[1..n,1..n] of integer;
i,j,c: integer;
begin
c:= -4;
for i:=1 to n do
begin
if (i<>1) and (i<>9)
then c:= c+1;
writeln;
for j:=1 to n do
begin
if (j=1) or (j=9) or (i=1) or (i=9)
then a[i,j]:= 1
else if (j = 5 - abs(c)) or (j = 5 + abs(c))
then a[i,j]:= 1
else a[i,j]:= 0;
write(a[i,j],' ');
end;
end;
end.
№4
program raf105;
const
n1 = 10;
n2 = 9;
var
a: array[1..n1,1..n2] of integer;
i,j: integer;
begin
for i:=1 to n1 do
begin
writeln;
for j:=1 to n2 do
begin
if i mod 2 <> 0
then a[i,j]:= 1
else a[i,j]:= 0;
write(a[i,j],' ');
end;
end;
end.