Thread: Help in left aligned triangle T.T

  1. #1
    Registered User
    Join Date
    Dec 2013
    Posts
    1

    Red face Help in left aligned triangle T.T

    Hi, can anyone help me in constructing this right aligned half pyramid? The code I had so far is right aligned and they're not in numberss

    Write a program that receives one positive integer and display
    _________ _ 1
    ________ 4 2
    _______9 6 3
    ___16 12 8 4
    25 20 15 10 5

    when the user key in 5.PS: ignore the line
    Last edited by Ah Kok; 12-28-2013 at 03:38 PM.

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    What have you tried so far? We can't just give you code, you wouldn't learn anything that way. Post your attempt, with clear, specific questions, then we can assist you.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    To preserve the design you want to display, put it between
    [:code] [:/code] (don't type in the :'s)

    Code:
    Like this 123
             4567
    
    etc.
    tags. Use the '#' icon, in the advanced editor, or just keyboard them in manually.
    Last edited by Adak; 12-28-2013 at 05:07 PM.

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Guess on what your display is supposed to look like.
    I suggest reading up on printf function.
    Code:
    Ignore this Line; the first line must not start with a space.
                  1
              4   2
           9  6   3
       16 12  8   4
    25 20 15 10   5
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C compiler reads from right to left or left to right?
    By ajishgopalr in forum C Programming
    Replies: 12
    Last Post: 07-16-2011, 08:12 PM
  2. Replies: 9
    Last Post: 07-23-2010, 06:31 PM
  3. what is aligned and unaligned data in c
    By bhrugu in forum C Programming
    Replies: 1
    Last Post: 01-11-2010, 01:40 PM
  4. Do pointers returned by malloc/new have to be aligned?
    By pheres in forum C++ Programming
    Replies: 6
    Last Post: 03-24-2009, 12:03 PM
  5. print out proper aligned tect...
    By kenni81 in forum C Programming
    Replies: 3
    Last Post: 02-09-2003, 05:00 PM