using System;
namespace P4_18
{
    public class ParamExample
    {
        public int Sum(params int[] list)
        {
            int total = 0;
            foreach (int i in list)
            {
                total += i;
            }
            return total;
        }
    }
    class Program
    {
        static void Main()
        {
            ParamExample pe = new ParamExample();
            int total = pe.Sum(1, 2, 3, 4, 5, 6, 7);
            Console.WriteLine(total); // total=28
            Console.ReadLine();
        }
    }
}
