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

Friday, June 12, 2015

Enter the number:5

                               1
                       a      e     i
                  2   3      4    5   6
             o  u    a      e     i    o    u
           7  8  9  10  11   12  13  14  15
class Program
{
    static void Main(string[] args)
    {
        int ro, cl, i = 0, no, A = 1;
        string[] arr = new string[] { "a", "e", "i", "o", "u" };
        Console.WriteLine("Enter a value : ");
        no = int.Parse(Console.ReadLine());

        for (ro = 1; ro <= no; ro++)
        {
            for (cl = no; cl > ro; cl--)
            {
                Console.Write("   ");
            }

            for (cl = 1; cl <= (ro * 2 - 1); cl++)
            {
                if (ro % 2 != 0)
                {
                    Console.Write("  " + A);
                    A++;
                }
                else
                {
                    Console.Write("  " + arr[i]);
                    i++;
                    if (i > 4)
                        i = 0;
                }
            }
            Console.WriteLine("");
        }
        Console.ReadLine();
    }


}

No comments: