We are providing online training of realtime Live project on Asp.Net MVC with Angular and Web API. For more information click here. If you have any query then drop the messase in CONTACT FORM

Tuesday, June 23, 2015


    class Program
    {
        static void Main(string[] args)
        {
            int temp = 0;
            Console.WriteLine("Enter the row number");
            int n = int.Parse(Console.ReadLine());

            for (int row = 0; row <= n - n / 3; row++)
            {
                for (int coll = 0; coll < n; coll++)
                {
                    temp = 2 * n / 5;
                    if (temp % 2 != 0)
                        temp--;
                    if (row == n / 5 || row == n - n / 3 || (coll == n - 1 && row >= n / 5) ||
                        (coll >= n / 5 && coll < n - n / 5 && row == 0) || (coll == 0 && row >= n / 5) ||
                        (coll == temp && row > n / 5) || (row <= n / 5 && (row + coll == n / 5 ||
                        coll - row == n / 5)) || (coll - row == n - n / 5))
                    {
                        Console.Write("*" + " ");
                    }

                    else if (row == n / 5 + n / 7 && (coll >= n / 7 && coll <= temp - n / 7))
                    {
                        Console.Write("_" + " ");
                    }

                    else if (row >= n / 5 + n / 7 && (coll == n / 7 || coll == temp - n / 7))
                    {
                        Console.Write("| ");
                    }

                    else
                    {
                        Console.Write("  ");
                    }
                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }


    }

No comments: