Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Wednesday, February 22, 2017

Pattern printing program program number 54

Pattern printing program  Implementation:



using System;

namespace patternProblem
{
    class Pattern121
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Enter loop iteration times: ");
            int n = Convert.ToInt32(Console.ReadLine());
            int j;
            int i;
            Console.WriteLine("-----Output-----");
            Console.WriteLine();

            for (i = 1; i <= n; i++)
            {
                for (j = n; j >= i; j--)
                {
                    Console.Write(" ");
                }
                for (j = 1; j <= i; j++)
                {
                    Console.Write("*");
                }
                for (j = j - 1; j >= 1; j--)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }
            for (i = n; i >= 1; i--)
            {
                for (j = n; j >= i; j--)
                {
                    Console.Write(" ");
                }
                for (j = 1; j <= i; j++)
                {
                    Console.Write("*");
                }
                for (j = j - 1; j >= 1; j--)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }

            Console.ReadKey();
        }
    }
}

No comments:

Post a Comment