===== PascalABC.NET =====
type
Vector = array of real;
function operator +(a, b: Vector): Vector;
ExtensionMethod := a.Zip(b, (p, q) -> p + q).ToArray;
function operator -(a, b: Vector): Vector;
ExtensionMethod := a.Zip(b, (p, q) -> p - q).ToArray;
function operator *(s: real; a:Vector): Vector;
ExtensionMethod := a.ConvertAll(p -> p * s);
begin
var a: Vector := ReadArrReal('Вектор a:', 3);
var b: Vector := ReadArrReal('Вектор b:', 3);
var c: Vector := ReadArrReal('Вектор c:', 3);
var k := ReadReal('k =');
Println(k * (a + b) + (1 - k) * (a + c))
end.
Program n1;
var q,w,e:integer;
a:array [1..25]of integer;
for q:=1 to 25 do begin
a[q]:=random(30);
write(a[q],' ');
end;
Program n2;
var q:integer;
a:array [1..30]of integer;
a[1]:=5;
writeln(a[1],' ');
for q:=2 to 26 do begin
a[q]:=a[q-1]+5;
writeln(a[q],' ');
Program n3;
a:array [1..15]of integer;
for q:=1 to 15 do begin
a[q]:=random(30)-50;
Объяснение:
===== PascalABC.NET =====
type
Vector = array of real;
function operator +(a, b: Vector): Vector;
ExtensionMethod := a.Zip(b, (p, q) -> p + q).ToArray;
function operator -(a, b: Vector): Vector;
ExtensionMethod := a.Zip(b, (p, q) -> p - q).ToArray;
function operator *(s: real; a:Vector): Vector;
ExtensionMethod := a.ConvertAll(p -> p * s);
begin
var a: Vector := ReadArrReal('Вектор a:', 3);
var b: Vector := ReadArrReal('Вектор b:', 3);
var c: Vector := ReadArrReal('Вектор c:', 3);
var k := ReadReal('k =');
Println(k * (a + b) + (1 - k) * (a + c))
end.
Program n1;
var q,w,e:integer;
a:array [1..25]of integer;
begin
for q:=1 to 25 do begin
a[q]:=random(30);
write(a[q],' ');
end;
end.
Program n2;
var q:integer;
a:array [1..30]of integer;
begin
a[1]:=5;
writeln(a[1],' ');
for q:=2 to 26 do begin
a[q]:=a[q-1]+5;
writeln(a[q],' ');
end;
end.
Program n3;
var q:integer;
a:array [1..15]of integer;
begin
for q:=1 to 15 do begin
a[q]:=random(30)-50;
writeln(a[q],' ');
end;
end.
Объяснение: