var a: array of string; b: List<integer> := new List<integer>(); f, g: string;
begin readln(f, g); System.IO.File.WriteAllText(f, ''); System.IO.File.WriteAllText(g, ''); for k: byte := 1 to 10 do System.IO.File.AppendAllText(f, IntToStr(Random(25)) + System.Environment.NewLine); a := System.IO.File.ReadAllLines(f); foreach k: string in a do b.Add(StrToInt(k)); var i: integer; while (i < b.Count - 1) do begin while (b.IndexOf(b[i]) <> b.LastIndexOf(b[i])) do b.RemoveAt(b.LastIndexOf(b[i])); inc(i); end; foreach k: integer in b do System.IO.File.AppendAllText(g, IntToStr(k) + System.Environment.NewLine); end.
Var a,b,c,n:integer; begin for a:=1 to 7 do for b:=a+1 to 8 do for c:=b+1 to 9 do begin n:=a*100+b*10+c; write(n:4) end; end.
var i,j,n:integer; a:array[1..4,1..5]of real; begin for i:=1 to 4 do begin for j:=1 to 5 do begin a[i,j]:=random*2-1; write(a[i,j]:20:15); if a[i,j]>=0 then n:=n+1; end; writeln; end; writeln('Количество неотрицательных: ',n); end.
var i,j,sum:integer; a:array[1..3,1..4]of integer; begin for i:=1 to 3 do for j:=1 to 4 do readln(a[i,j]); writeln('Массив:'); for i:=1 to 3 do begin for j:=1 to 4 do begin sum:=sum+a[i,j]; write(a[i,j]:4); end; writeln('sum=':8,sum); sum:=0; end; end.
System.Collections.Generic;
var
a: array of string;
b: List<integer> := new List<integer>();
f, g: string;
begin
readln(f, g);
System.IO.File.WriteAllText(f, '');
System.IO.File.WriteAllText(g, '');
for k: byte := 1 to 10 do
System.IO.File.AppendAllText(f, IntToStr(Random(25)) + System.Environment.NewLine);
a := System.IO.File.ReadAllLines(f);
foreach k: string in a do
b.Add(StrToInt(k));
var i: integer;
while (i < b.Count - 1) do
begin
while (b.IndexOf(b[i]) <> b.LastIndexOf(b[i])) do
b.RemoveAt(b.LastIndexOf(b[i]));
inc(i);
end;
foreach k: integer in b do
System.IO.File.AppendAllText(g, IntToStr(k) + System.Environment.NewLine);
end.
begin
for a:=1 to 7 do
for b:=a+1 to 8 do
for c:=b+1 to 9 do
begin
n:=a*100+b*10+c;
write(n:4)
end;
end.
var
i,j,n:integer;
a:array[1..4,1..5]of real;
begin
for i:=1 to 4 do
begin
for j:=1 to 5 do
begin
a[i,j]:=random*2-1;
write(a[i,j]:20:15);
if a[i,j]>=0 then n:=n+1;
end;
writeln;
end;
writeln('Количество неотрицательных: ',n);
end.
var
i,j,sum:integer;
a:array[1..3,1..4]of integer;
begin
for i:=1 to 3 do
for j:=1 to 4 do
readln(a[i,j]);
writeln('Массив:');
for i:=1 to 3 do
begin
for j:=1 to 4 do
begin
sum:=sum+a[i,j];
write(a[i,j]:4);
end;
writeln('sum=':8,sum);
sum:=0;
end;
end.