Ad
Code
Diff
  • namespace Solution
    {
        public class MyCalculator
        {
            public int Add(params int[] values)
            {
                int  sum = 0;
                foreach (int v in values) {
                  sum += v;
                }
                return sum;
            }
        }
    }
    • namespace Solution
    • {
    • public class MyCalculator
    • {
    • public int Add(int a, int b)
    • public int Add(params int[] values)
    • {
    • return a + b;
    • int sum = 0;
    • foreach (int v in values) {
    • sum += v;
    • }
    • return sum;
    • }
    • }
    • }