예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("To Perform Reverse operation Press '1' ");
            Console.WriteLine("To Perform Reverse String operation Press '2' ");
            Console.WriteLine("To find the maximum number Press '3' ");
            Console.WriteLine("To find the minimum number Press '4' ");
            Console.WriteLine("To Perform String Manipulation Press '5' ");
            Console.WriteLine("To Perform Number Operation Press '6' ");

            var res = Convert.ToInt32(Console.ReadLine());

            if (res == 1)
            {
                Reverse.rev();
            }
            if (res == 2)
            {
                Reverse.revstring();
                Console.ReadLine();
            }
            if (res == 3)
            {
                MaxMin.max();
                Console.ReadLine();
            }
            if (res == 4)
            {
                MaxMin.min();
                Console.ReadLine();
            }
            if (res == 5)
            {
                StringManipulation.str();
                Console.ReadLine();
            }
            if (res == 6)
            {
                NumberOperations.neg();
                Console.ReadLine();
                NumberOperations.pos();
                Console.ReadLine();
                NumberOperations.oddeven();
                NumberOperations.armstrong();
                NumberOperations.fibo();
                Console.ReadLine();
            }
        }
예제 #2
0
        public static void min()
        {
            MaxMin d1 = new MaxMin();

            Console.WriteLine("enter any 5 numbers to find the maximum of 5 numbers");
            d1.arr1 = Convert.ToInt32(Console.ReadLine());
            d1.arr2 = Convert.ToInt32(Console.ReadLine());
            d1.arr3 = Convert.ToInt32(Console.ReadLine());
            d1.arr4 = Convert.ToInt32(Console.ReadLine());
            d1.arr5 = Convert.ToInt32(Console.ReadLine());

            int[] arr = { d1.arr1, d1.arr2, d1.arr3, d1.arr4, d1.arr5 };
            int   min = arr[0];

            for (int i = 1; i < arr.Length; i++)
            {
                if (arr[i] < min)
                {
                    min = arr[i];
                }
            }
            Console.WriteLine("the minimum number from the given numbers is {0} ", min);
        }