public int f(params int[] lst) { int sum = 0; for (int i=0; i< lst.Length; i++) sum += lst[i]; return sum; } int[] arr = {3, 4, 5}; int total = f(arr); //12 int[] arr2 = {12, 3, 4, 5}; int total2 = f(arr); //24 int total3 = f(12,3,4,5); //24
int total4 = f(); //0