Solution Q.No. 2 of problem set

/*
Problem Set 
Q.No.2: Program that prints following series on the console up to 10 times:
1, 101, 1001, 10001, 100001, 1000001, .....
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication6
{
    class Program
    {
   
        static void Main(string[] args)
        {
            string s = "1";
            Console.WriteLine(s);
            for(int i=2; i<10; i++)
            {                
                Console.WriteLine(s.PadRight(i, '0')+"1");
            }

        }
    }
}

 

Add a Comment

Your email address will not be published. Required fields are marked *