Example #1
0
        /// <summary>
        /// Calling the factorial method
        /// </summary>
        /// <param name="args">The command-line arguments.</param>
        static void Main(string[] args)
        {
            NumberManipulator n = new NumberManipulator();

            Console.WriteLine("Factorial of 6 is : {0}", n.Factorial(6));
            Console.WriteLine("Factorial of 7 is : {0}", n.Factorial(7));
            Console.WriteLine("Factorial of 8 is : {0}", n.Factorial(8));
            Console.ReadLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            /*local variable declaration*/
            int a = 100;
            int b = 200;
            int?c = null;
            int d;
            int ret;
            NumberManipulator n = new NumberManipulator();

            //Calling the FindMax method
            ret = n.FindMax(a, b);
            Console.WriteLine("Max value is: {0}", ret);
            for (int i = 1; i <= 13; i++)
            {
                Console.WriteLine("Factorial of {0} is: {1}", i, n.Factorial(i));
            }

            Console.WriteLine("Before method call, value of a : {0}", a);
            Console.WriteLine("Before method call, value of b : {0}", b);
            /* calling a function to get the value */
            n.getValue(out a, out b);
            Console.WriteLine("After method call, value of a : {0}", a);
            Console.WriteLine("After method call, value of b : {0}", b);

            // NUll Coalescing
            d = c ?? 5;
            Console.WriteLine(" Value of d: {0}", d);
            c = 2;
            d = c ?? 5;
            Console.WriteLine(" Value of d: {0}", d);
            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            /*local variable declaration*/
            int a = 100;
            int b = 200;
            int? c = null;
            int d;
            int ret;
            NumberManipulator n = new NumberManipulator();

            //Calling the FindMax method
            ret = n.FindMax(a,b);
            Console.WriteLine("Max value is: {0}", ret);
            for (int i = 1; i <= 13; i++)
            {
                Console.WriteLine("Factorial of {0} is: {1}",i , n.Factorial(i));
            }

            Console.WriteLine("Before method call, value of a : {0}", a);
            Console.WriteLine("Before method call, value of b : {0}", b);
            /* calling a function to get the value */
            n.getValue(out a, out b);
            Console.WriteLine("After method call, value of a : {0}", a);
            Console.WriteLine("After method call, value of b : {0}", b);

            // NUll Coalescing
            d = c ?? 5;
            Console.WriteLine(" Value of d: {0}", d);
            c = 2;
            d = c ?? 5;
            Console.WriteLine(" Value of d: {0}", d);
            Console.ReadLine();
        }