1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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,285
    Likes Received:
    364
    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