using System.Collections.Generic;
public static Tuple<int, int> FindTwoSum(IList<int> list, int sum)
for(int i = 0; i < list.Count; i++){
for(int j = 1; j < list.Count - 1; j++) {
if(list[i] + list[j] == sum) return new Tuple<int, int>(i, j);
public static void Main(string[] args)
Tuple<int, int> indices = FindTwoSum(new List<int>() { 1, 3, 5, 7, 9 }, 12);
Console.WriteLine(indices.Item1 + " " + indices.Item2);