SumParams

using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

namespace SumParams
{

  public class Program
  {
public static void Main()
{
  int result = Sum(1, 2, 3, 4, 5, 9, 88, 1838, 2838);
  Console.WriteLine(result);
}


public static int Sum(params int[] x)
{
  int answer = 0; ;
  for (int i = 0; i < x.Length; i++)
  {
answer = answer + x[i];
  }
  return answer;
}
  }
}

Comments

Popular Posts