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

Wednesday, June 24, 2015

Input the row number:5    
                  1
               a  e  i
            2 3 4  5 6        
        o u  a  e  i  o u
    7  8 9 1 2 3 4 5 6 7 

class Program
    {
        static void Main(string[] args)
        {
            int temp = 1, value = 0;
            Console.WriteLine("Enter the row number");
            int n = int.Parse(Console.ReadLine());
            char[] ch = { 'a', 'e', 'i', 'o', 'u' };
            for (int row = 1; row <= n; row++)
            {
                for (int space = n; space > row; space--)
                {
                    Console.Write(" ");
                }
                for (int coll = 1; coll <= 2 * row - 1; coll++)
                {
                    if (row % 2 != 0)
                    {
                        Console.Write(temp);
                        temp++;
                        if (temp > 9)
                        {
                            temp = 1;
                        }
                    }
                    else
                    {
                        Console.Write(ch[value]);
                        value++;
                        if (value == n)
                        {
                            value = 0;
                        }
                    }
                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }


    }

No comments: