Skip to content

Looping concept

Vignesh Madeshwaran

Asked Jul 20, 2014, 8:06 PM EDT1 answer
Share
LinkedInX
Hello friends i want output like this way in c#
 
 
          *
          ***
          *****
          *******
          ******** 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    C#
        class Program
        {
            static void Main(string[] args)
            {
                int i, j; string s = "";
                int n = 7; //no. of lines
                for (i=1; i <= n; i++)
                {
                    s = "";
                    for (j = 1; j <= (i * 2) - 1; j++)
                    {
                        s += "*";
                    }
                    Console.WriteLine(s);
                    Console.WriteLine();
                }
    
    
    
    
                Console.Read();
            }
        }
    0