static void Main() { var size = default(int); var al = new List <int>(); var success = false; while (!success) { Console.WriteLine("Enter the size of Array (size should be greater than 2):"); var enteredSize = Console.ReadLine(); success = int.TryParse(enteredSize, out size); success = success && (size >= 2); } Console.WriteLine("Enter the array value"); for (int i = 0; i < size; i++) { al.Add(Convert.ToInt32(Console.ReadLine())); } Console.WriteLine("calculating the sum of biggest neighbour"); var obj = new CalculateSum(); Console.WriteLine(obj.Challenge(al.ToArray())); Console.ReadKey(); }
static void Main(string[] args) { CalculateSum test = new CalculateSum(Sum); //CalculateSum test = Sum; test += Div; test(5, 7); }
static void Main(string[] args) { int[] input = new int[] { 1, 2, 1, 5, 5, 3, 3, 3, 4 }; // int[] input = new int[] { 1, 6, 1, 2, -6, 1, -6, -6 }; //int[] input = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; //int[] input = new int[] { 6, 8 }; //int[] input = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }; CalculateSum cs = new CalculateSum(); int total = cs.Challenge(input); Console.WriteLine(total); Console.ReadLine(); }
public void GroupSize_is_4_get_sum_of_revenue_should_get_50_66_60() { //arrange var target = new CalculateSum(new StubEntities().GetEntitys(), "Revenue", 4); var expected = new List <int>() { 50, 66, 60 }; //act var actual = target.CalculateSumByColumnAndGroupSize(); //assert CollectionAssert.AreEquivalent(expected, actual); }
public void GroupSize_is_3_get_sum_of_cost_should_get_6_15_24_21() { //arrange var target = new CalculateSum(new StubEntities().GetEntitys(), "Cost", 3); var expected = new List <int>() { 6, 15, 24, 21 }; //act var actual = target.CalculateSumByColumnAndGroupSize(); //assert CollectionAssert.AreEquivalent(expected, actual); }
private void CountSum(object sender, EventArgs e) { CalculateSum?.Invoke(); }
public int CallFun(int num1, int num2, CalculateSum calledfun) { int sum = calledfun(num1, num2); return(sum); }