static void Main(string[] args) { NumArr numbers = () => { int[] numbers = { 3, 4, -5, 7, -8 }; for (int i = 0; i < numbers.Length; i++) { if (numbers[i] < 0) { numbers[i] = 0; } Console.Write(+numbers[i] + " "); } }; numbers(); }
static void Main(string[] args) { NumArr num = () => { ArrayList numbers = new ArrayList(); numbers.Add(23); numbers.Add(21); numbers.Add(-1); numbers.Add(45); numbers.Add(-6); for (int i = 0; i < numbers.Count; i++) { if ((int)numbers[i] < 0) { numbers[i] = "Codebits"; } Console.WriteLine(numbers[i]); } }; num(); }