Ad
Algorithms
Logic
Mathematics
Numbers
Code
Diff
  •  using System;
     using System.Linq;
    public class RussianExam
      {
            public static int[] ExamTask(int[] array)
            {
                return array.Select(x => x % 3 == 0 && x % 2 != 0 ? (x = array.Where(y => y % 3 == 0).Count()) : x=x).ToArray();
            }
      }
    
    • using System;
    • public class RussianExam
    • using System.Linq;
    • public class RussianExam
    • {
    • public static int[] ExamTask(int[] array)
    • public static int[] ExamTask(int[] array)
    • {
    • int count = 0;
    • for(int i = 0; i < array.Length; i++)
    • {
    • if (array[i] % 3 != 0 && array[i] % 2 == 0) count++;
    • }
    • for (int i = 0; i < array.Length; i++)
    • {
    • if (array[i] % 3 == 0 && array[i] % 2 != 0) array[i] = count;
    • }
    • return array;
    • return array.Select(x => x % 3 == 0 && x % 2 != 0 ? (x = array.Where(y => y % 3 == 0).Count()) : x=x).ToArray();
    • }
    • }