var
a: array[1..15] of integer;
b: array[1..20] of integer;
c: array[1..10] of integer;
i, maxa, maxb, maxc: integer;
begin
maxa := 0;
for i := 1 to 15 do
begin
read(a[i]);
if abs(a[i]) > maxa then maxa := abs(a[i]);
end;
maxb := 0;
for i := 1 to 20 do
begin
read(b[i]);
if abs(b[i]) > maxb then maxb := abs(b[i]);
end;
maxc := 0;
for i := 1 to 10 do
begin
read(c[i]);
if abs(c[i]) > maxc then maxc := abs(c[i]);
end;
if (maxa > maxb) and (maxa > maxc) then begin for i := 1 to 15 do write(a[i], ' ');writeln;writeln(maxa); end
else if (maxb > maxa) and (maxb > maxc) then begin for i := 1 to 20 do write(b[i], ' ');writeln;writeln(maxb); end
else if (maxc > maxb) and (maxc > maxa) then begin for i := 1 to 10 do write(c[i], ' ');writeln;writeln(maxc); end;
end.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Enter 12 integer numbers");
var Arr = new List<int>();
for (int i = 0; i < 12; i++)
{
Arr.Add(int.Parse(Console.ReadLine()));
}
Console.WriteLine($"Кол-во нулевых элементов: {Arr.Where(p => p == 0).Count()}");
Console.WriteLine($"Positive numbers product: {Arr.Where(p => p > 0).Aggregate(BigInteger.One, (p, q) => p * q)}");
Console.ReadKey();
}
}
Объяснение:
Добавьте ссылку на сборку System.Numerics в вашем проекте для корректной работы программы. Иначе будет ругаться на несуществующее пространство System.Numerics