Ejemplo n.º 1
0
        public static void Main(String[] args)
        {
            int[] value = new int[5] {
                1, 2, 3, 4, 5
            };
            Basics obj = new Basics();

            //PrintHelloWorld
            Console.WriteLine("****Start HelloWord****");
            obj.PrintHelloWorld();
            Console.WriteLine("****End HelloWord****");
            Console.WriteLine("\n");

            //GetSum
            Console.WriteLine("****Start GetSum****");
            Console.WriteLine(obj.GetSum(10, 20));
            Console.WriteLine("****End GetSum****");
            Console.WriteLine("\n");

            //GetLargerNumber
            Console.WriteLine("****Start GetLargerNumber****");
            Console.WriteLine(obj.GetLargerNumber(10, 20));
            Console.WriteLine("****End GetLargerNumber****");
            Console.WriteLine("\n");

            //LargestNumber
            Console.WriteLine("****Start LargestNumber****");
            Console.WriteLine(obj.LargestNumber(10, 20, 30));
            Console.WriteLine("****End LargestNumber****");
            Console.WriteLine("\n");

            //PrintArray
            Console.WriteLine("****Start PrintArray****");
            obj.PrintArray(value);
            Console.WriteLine("****End PrintArray****");
            Console.WriteLine("\n");

            //GetSumOfArrayElements
            Console.WriteLine("****Start GetSumOfArrayElements****");
            Console.WriteLine(obj.GetSumOfArrayElements(value, 5));
            Console.WriteLine("****End GetSumOfArrayElements****");
            Console.WriteLine("\n");

            //IsPrime Number
            Console.WriteLine("****Start IsPrime Number****");
            if (obj.IsPrime(5))
            {
                Console.WriteLine("Its Prime Number: True");
            }
            else
            {
                Console.WriteLine("Its Prime Number: False");
            }
            Console.WriteLine("****End IsPrime Number****");
            Console.WriteLine("\n");

            //GetArrayOfRangeOfNumbers
            Console.WriteLine("****Start GetArrayOfRangeOfNumbers****");
            foreach (int num in obj.GetArrayOfRangeOfNumbers(3, 9))
            {
                if (num != 0)
                {
                    Console.WriteLine(num);
                }
            }
            Console.WriteLine("****End GetArrayOfRangeOfNumbers****");
            Console.WriteLine("\n");

            //Factorial Number
            Console.WriteLine("****Start Factorial****");
            Console.WriteLine(obj.GetFactorial(3));
            Console.WriteLine("****End Factorial****");
            Console.WriteLine("\n");

            //Factorial Number without Looping
            Console.WriteLine("****Start Factorial Without Looping****");
            Console.WriteLine(obj.GetFactorialWithoutLoop(3));
            Console.WriteLine("****End Factorial Without Looping****");
            Console.WriteLine("\n");

            //ReverseDigits
            Console.WriteLine("****Start ReverseDigits****");
            Console.WriteLine(obj.ReverseDigits(1234));
            Console.WriteLine("****End ReverseDigits****");
            Console.WriteLine("\n");

            // PrimeNumbersInARange
            Console.WriteLine("****Start PrimeNumbersInARange****");
            foreach (int num in obj.PrimeNumbersInARange(0, 10))
            {
                if (num != 0)
                {
                    Console.WriteLine(num);
                }
            }
            Console.WriteLine("****End PrimeNumbersInARange****");
            Console.WriteLine("\n");

            //FindNumberOfOccurences
            Console.WriteLine("****Start FindNumberOfOccurences****");
            int[] Occurences = new int[] { 1, 1, 1 };
            Console.WriteLine(obj.FindNumberOfOccurences(Occurences, 1));
            Console.WriteLine("****End FindNumberOfOccurences****");
            Console.WriteLine("\n");

            //FindFirstOccurence
            Console.WriteLine("****Start FindFirstOccurence****");
            int[] FirstOccure = new int[] { 2, 2, 1 };
            Console.WriteLine(obj.FindFirstOccurence(FirstOccure, 1));
            Console.WriteLine("****End FindFirstOccurence****");
            Console.WriteLine("\n");

            //PrintRhombus
            Console.WriteLine("****Start PrintRhombus****");
            obj.PrintRhombus(5);
            Console.WriteLine("****End PrintRhombus****");
            Console.WriteLine("\n");

            //GetNumberLessThanTenInWords
            Console.WriteLine("****Start GetNumberLessThanTenInWords****");
            Console.WriteLine(obj.GetNumberLessThanTenInWords(6));
            Console.WriteLine("****End GetNumberLessThanTenInWords****");
            Console.WriteLine("\n");

            //GetNumberInWords
            Console.WriteLine("****Start GetNumberInWords****");
            Console.WriteLine(obj.GetNumberInWords(6715));
            Console.WriteLine("****End GetNumberInWords****");
            Console.WriteLine("\n");

            //PrintTrianglePointingRight
            Console.WriteLine("****Start PrintTrianglePointingRight****");
            obj.PrintTrianglePointingRight(10);
            Console.WriteLine("****End PrintTrianglePointingRight****");
            Console.WriteLine("\n");

            Console.ReadLine();
        }