static bool CheckSumInArray(int sumToCheck, int[] inputArray)
foreach(var number in inputArray)
int numberToFind = sumToCheck - number;
if(inputArray.Contains(numberToFind) && Array.IndexOf(inputArray, number) != Array.LastIndexOf(inputArray, numberToFind) && number != sumToCheck)
public static void Main()
int[] firstTest = {1, 2, 3, 9};
Console.WriteLine("Output 1: " + CheckSumInArray(8, firstTest));
int[] secondTest = {1, 2, 4, 4};
Console.WriteLine("Output 2: " + CheckSumInArray(8, secondTest));
int[] anotherTest = {0, 3, 7, 8};
Console.WriteLine("Output 3: " + CheckSumInArray(8, anotherTest));
int[] yourTest = {0,0,0,0};
Console.WriteLine("Guest output: " + CheckSumInArray(8, yourTest));