Предмет: Информатика, автор: hoopooh

написать программу для решения задачи: Произвольно вводится одномерный массив из 15 целых чисел, все числа больше -10 и меньше 10. Вывести массив на экран. Найти наименьшее четное число и наибольшее нечетное число. Посчитать количество нулей в массиве. Заменить отрицательные числа числом 300 и вывести измененный массив на экран

Ответы

Автор ответа: HappyCoder
0

PascalABC.Net

  • begin
  •  var a := ArrRandom(15, -10, 10);
  •  Println('Массив', a);
  •  Println('Наименьшее четное: ', a.Where(x -> not Odd(x)).Min);
  •  Println('Наибольшее нечетно: ', a.Where(x -> Odd(x)).Max);
  •  Println('Колличество нулей: ', a.Where(x -> x = 0).Count);
  •  Print('Измененный массив: ');
  •  for var i := 0 to High(a) do
  •    if a[i] < 0 then
  •    begin
  •      a[i] := 300;
  •    end;
  •  Print(a);
  • end.

Похожие вопросы
Предмет: Английский язык, автор: malishka1105

Помогите пожалуйста!!!! Put in the соrrect form of the word in hockets. Adiective оr odverb? 1. I don't feel (well)....... I think I'll go home and have а (good)... night's sleep tonight. 2. You've been (wrоng)... informed, оr perhaps you've got the (wrong)... address. This house is not for sale. 3. Spanish is а (terrible)...difficult language to understand because the Spanish speak so fast. 4. She's а (fast) ...driver. She drives too (fast) fоr me! 5. Сап you recommend mе а (good)... English соurse? А book that is really(well).... written? 6. (sudden).... I hеаrd а loud bang. It was so (пеаr).... that I (пеаr)...... had а heart-attack! 7. Grаmmаr is not always (easy)......but you сап (easy)...do this exercise. 8. In winter it gets (dаrk)...very (rapid)...in this part of Northern Scotland. 9. (good)......ideas аrе not always (easy)....to find. If you want to do а thing (good).....you have to work (hard)..... 10. Yesterdayit rained (heavy)... and even today we've had some (heavy)... showers. 11. Do you (serious).....expect mе to believe уour story? 12.I'm (happy).....to say that John and Dеbоrаh are поw mаrried.. 1З. Не mаrсhed (аngrу)...out of the rооm. 14. She worked verу (hard)......for hеr exams. It was а (hard)......time for hеr and her family. She was so (busy)...that her friends (hard),,,,,ever saw her. 15. I've got а (bad).....toothache. If mу tooth goes оп hurting as (bad)......as this, I'll hаvе to go to the dentist's.

Предмет: Математика, автор: 6Ано6ним6
Предмет: Алгебра, автор: Manasaww