コード例 #1
0
        public static void pos()
        {
            NumberOperations N1 = new NumberOperations();

first:
            Console.WriteLine("enter any 5 numbers to find the negative numbers");
            N1.arr1 = Convert.ToInt32(Console.ReadLine());
            N1.arr2 = Convert.ToInt32(Console.ReadLine());
            N1.arr3 = Convert.ToInt32(Console.ReadLine());
            N1.arr4 = Convert.ToInt32(Console.ReadLine());
            N1.arr5 = Convert.ToInt32(Console.ReadLine());

            int[] arr = { N1.arr1, N1.arr2, N1.arr3, N1.arr4, N1.arr5 };
            for (int i = 0; i < arr.Length; i++)
            {
                if (arr[i] > 0)
                {
                    Console.WriteLine("Positive numbers in the input that you given is {0}", arr[i]);
                }
            }
            Console.WriteLine("Do you want to check another number, If yes press 'y'");
            var res5 = Console.ReadLine();

            if (res5 == "y")
            {
                goto first;
            }

            Console.ReadLine();
        }
コード例 #2
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();
            }
        }