Ответ:
--- PascalABC.NET 3.6.2 ---
#1
begin
var A := ArrRandom(70, -99, 99);
A.Println;
A.Where(p -> (Abs(p).ToString.Length = 2) and (p mod 10 = 3)).Aggregate(BigInteger.One, (p, q) -> p * q).Println;
end.
#2
var A := ArrRandom(70, -999, 999);
A.Where(p -> (Abs(p).ToString.Length = 3) and (p mod 5 <> 0)).Average.Println;
Объяснение:
// 1
var n := ReadInteger('n =');
var a := ArrRandom(n, -150, 150);
a.Println;
a.Where(p-> Abs(p) in 10..99).Product(p-> BigInteger(p)).Println;
// 2
var b := ArrRandom(n, -150, 150);
a.Where(p -> (Abs(p) in 100..999) and (p mod 5 <> 0)).Average.Print;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
--- PascalABC.NET 3.6.2 ---
#1
begin
var A := ArrRandom(70, -99, 99);
A.Println;
A.Where(p -> (Abs(p).ToString.Length = 2) and (p mod 10 = 3)).Aggregate(BigInteger.One, (p, q) -> p * q).Println;
end.
#2
begin
var A := ArrRandom(70, -999, 999);
A.Println;
A.Where(p -> (Abs(p).ToString.Length = 3) and (p mod 5 <> 0)).Average.Println;
end.
Объяснение:
begin
// 1
var n := ReadInteger('n =');
var a := ArrRandom(n, -150, 150);
a.Println;
a.Where(p-> Abs(p) in 10..99).Product(p-> BigInteger(p)).Println;
// 2
var b := ArrRandom(n, -150, 150);
a.Println;
a.Where(p -> (Abs(p) in 100..999) and (p mod 5 <> 0)).Average.Print;
end.