1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Help me to execute this c program

Discussion in 'C' started by priyasub, May 1, 2009.

  1. priyasub

    priyasub New Member

    Joined:
    May 1, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    i need a help in executing a for loop... the output should be in the form as below
    *
    **
    ***
    ****


    how to do it..
    im new to learn c language..
    help me
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    You created the same thread more than once and also in the wrong forum and I have moved them into C-C++ forum for better response.

    Also regarding your question I guess you need to look into using loops because this question is just a one line program using loops
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Build it up bit by bit.

    Start with a for loop that displays a number of asterisks. Make it so that you can set the number, e.g.
    Code:
    int num=10; // this determines the number we print
    for ( /* ??? but reference num */)
    {
      /* ??? */
    }
    
    If that's too difficult then just write a loop that displays a fixed number of asterisks, say 5. Then replace the 5's with num and you can experiment by changing the value of num a few times to make sure it works.

    Then enclose that lot in a loop that varies the value of num. By the looks of it each line is one asterisk longer than the previous so that should be easy.
     

Share This Page