help for simple output:-

Discussion in 'C' started by skp819, Dec 12, 2008.

  1. skp819

    skp819 New Member

    Joined:
    Dec 8, 2008
    Messages:
    89
    Likes Received:
    3
    Trophy Points:
    0
    hello, I am harish kumar,
    I feel helpless for a simple program. please help me to create a program for the below output.
    thanks in advance.


    * 1
    ** 22
    *** 333
    **** 4444
    ***** 55555
    please help................
     
    Last edited: Dec 12, 2008
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,335
    Likes Received:
    377
    Trophy Points:
    83
    simple here is pseudo code.
    Code:
    for(i=1;i<=n;i++)
    {
      for(j=1;j<=i;j++)
      {
        print("*");
      }
      for(j=1;j<=i;j++)
      {
        print(i);
      }
      print("\n");
    }
     
  3. skp819

    skp819 New Member

    Joined:
    Dec 8, 2008
    Messages:
    89
    Likes Received:
    3
    Trophy Points:
    0
    oh thanks
    I found the solution

    for(i=1;i<=5;i++)
    {
    for(j=1;j<=i;i++)
    {
    cout<<"*"<<i;
    }
    cout<<"\n";
    }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice