Wednesday, 5 April 2017

Print Number 12345

Print Number 12345 

#1 :-USING The Console Application in Visual Studio.

#2:- Add-This Class
------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PrintNumber12345
{
    /// <summary>
    /// This is Used for print number like in below
    /// 1
    /// 12
    /// 123
    /// 1234
    /// 12345
    /// 1234
    /// 123
    /// 12
    /// 1
    /// Powered By :- DOTNET BY VICKYPEDIA
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Powered By :- DOTNET BY VICKYPEDIA");
            Console.Write("\n");
            int number = 5;
           
            //Loop For PRINT Like
            //This Loop Start with i=1 and end with 5
            //-1
            //-12
            //-123
            //-1234
            //-12345
            for (int i = 1; i <= number; ++i)
            {
                for (int x = 1; x <= i; ++x)
                {
                    Console.Write(x);
                }
                Console.Write("\n");
            }

            //Loop For PRINT Like
            //This Loop Start with i=4 and end with 1
            //-1234
            //-123
            //-12
            //-1
            for (int i = number - 1; i >= 1; --i)
            {
                for (int x = 1; x <= i; ++x)
                {
                    Console.Write(x);
                }
                Console.Write("\n");
            }

            Console.Write("\n Thanks You");
            Console.ReadLine();

        }
    }
}
-------------------------------------------------------------------------------------------------


No comments:

Post a Comment

Factorial of a Number

Recently Viewed