示例#1
0
        static void Main(string[] args)
        {
            int high;

            Console.WriteLine("Enter the number of inputs: ");
            high = Convert.ToInt32(Console.ReadLine());
            int low = 0;

            int[] A = new int[high];

            Console.WriteLine("Enter the numbber you want to add:");

            for (int i = 0; i < high; i++)
            {
                A[i] = Convert.ToInt32(Console.ReadLine());
            }

            addition a      = new addition();
            int      result = a.RecursiveAdd(A, low, high - 1); // Line A

            Console.WriteLine("Sum: " + result);


            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            int n;

            Console.WriteLine("Enter the number of inputs: ");
            n = Convert.ToInt32(Console.ReadLine());

            int[] arr = new int[n];

            Console.WriteLine("Enter the numbber you want to add:");

            for (int i = 0; i < n; i++)
            {
                arr[i] = Convert.ToInt32(Console.ReadLine());
            }

            addition a      = new addition();
            int      result = a.RecursiveAdd(arr, n); // Line A

            Console.WriteLine("Sum: " + result);


            Console.ReadKey();
        }