To print Pattern?

Discussion in 'C#' started by Vivianflo, Apr 20, 2012.

  1. #1
    I have to print this below pattern in C#

    /*
    1
    111
    1111
    11111
    */

    How can i get this output?
     
    Vivianflo, Apr 20, 2012 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,830
    Likes Received:
    4,541
    Best Answers:
    123
    Trophy Points:
    665
    #2
    I would have thought that would be pretty straightforward in any programming language.

    What business problem are you trying to solve or is this schoolwork?
     
    sarahk, Apr 21, 2012 IP
  3. amkeabhi123

    amkeabhi123 Member

    Messages:
    219
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #3
    for (int i = 1; i < 5; i++)
    {
    for (int j = 1; j <= i; j++)
    {
    Response.Write("1");


    }
    Response.Write("<div style='clear:both;'></div>");
    }
     
    amkeabhi123, Jun 20, 2012 IP