namespace demo_array
{
class Program
{
static int Add(params int[] nums)
{
int total = 0;
foreach (int i in nums)
{
total = total + i;
}
return total;
}
static void Main(string[] args)
{
Console.WriteLine("Parameter Array Function Testing ...");
int result = 0;
/* function allowing 3 arguments */
result = Add(10, 15, 20);
Console.WriteLine("Result for 3 Prameter :{0}", result);
Console.ReadKey();
}
}
}