// PascalABC.NET 3.3, сборка 1634 от 14.02.2018 // Внимание! Если программа не работает, обновите версию!
type tCar=record brand:string; cost:real; end;
begin var a:=new tCar[4]; for var i:=0 to 3 do begin var b:=ReadlnString(i+1+') введите марку и стоимость в рублях:').ToWords; a[i].brand:=b[0]; a[i].cost:=b[1].ToReal; end; var m:=a.Select(t->t.cost).Average; var p:=a.Select(t->Abs(t.cost-m)).ToArray.IndexMin; Writeln('Выбран автомобиль марки ',a[p].brand,' стоимостью ',a[p].cost) end.
int x = int.Parse(Console.ReadLine());
double[,] mas = new double[x, x];
Console.WriteLine("Заполни матрицу");
for (int i = 0; i < x; i++) {
for (int j = 0; j < x; j++) {
mas[i, j] = double.Parse(Console.ReadLine());
}
}
for (int i = 0; i < x; i++) {
for (int j = 0; j < x; j++) {
if (mas[i, j] % 3 == 0) {
mas[i, j] = 0;
}
}
}
Console.WriteLine("Такая матрица получится");
for (int i = 0; i < x; i++) {
for (int j = 0; j < x; j++) {
Console.Write(mas[i, j]+" ");
}
Console.WriteLine();
}
Console.ReadKey();