Thread: how to print this shape?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    4

    how to print this shape?

    hi all,
    i am new here..
    and i need help..

    when we print this shape

    1
    2 3
    3 4 5
    4 5 6 7
    5 6 7 8 9
    6 7 8 9 10 11
    7 8 9 10 11 12 13
    8 9 10 11 12 13 14 15

    we print this program..
    Code:
    for(i=1;i<=8;i++)
    {
    k=i;
    for(j=1;j<=i;j++)
    {
    cout<<k;
    k++;
    }
    cout<<endl;
    }
    i have programed that
    but when my teacher ask me this one
    in this one i need help
    1
    5 3
    6 4 5
    7 5 6 7
    8 6 7 8 9
    7 8 9 10 11
    8 9 10 11 12 13
    9 10 11 12 13 14 15

    please help me...
    Last edited by Salem; 01-28-2010 at 11:51 AM. Reason: / not \ in the tags

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Towr of Hanoi move the disc
    By WatchTower in forum C Programming
    Replies: 9
    Last Post: 07-17-2009, 03:48 AM
  2. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 12:13 AM
  3. Scope And Parameter Passing
    By djwicks in forum C Programming
    Replies: 6
    Last Post: 03-28-2005, 08:26 PM
  4. Newbie- having trouble with functions
    By bnmwad in forum C Programming
    Replies: 7
    Last Post: 02-22-2005, 04:41 PM
  5. What kind of programs should I start writing?
    By Macabre in forum C++ Programming
    Replies: 23
    Last Post: 04-12-2003, 08:13 PM