Results 1 to 9 of 9

Thread: Program problem

  1. #1
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default Program problem

    Hi ALL,
    I am a new member to this community as well I am new to Java. I am stuck with some of my assignments. Can anybody please help me out in coding this problems?
    I need an output of this sort:-
    1
    2 3
    4 5 6
    7 8 9 10
    Last edited by arindamchkrbrty; 03-08-2009 at 06:41 PM. Reason: The code output is not what I desire

  2. #2
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default

    Please see that It will look like more or less like equilateral triangle. While I put the thread I found that the figure is left alligned!

  3. #3
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    do you have a specific problem?
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  4. #4
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default Not able to code

    Hi,
    Yeah I am not able to code this out. I am totally new to Java and so can't code it. But I need it very urgently.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    A couple of points. Most of us have found that those who succeed in programming courses will first try to find a solution (no matter how bad), on their own first, then if they have problems, come here and post their code with their specific question. I strongly suggest that you try to solve your problem on your own first, then come back with your code and questions if you are stuck. Remember to plan out the program on paper first before trying to commit it into Java, and to only add code in small batches, making sure that the code compiles without error before trying to add any more. Best of luck!

  6. #6
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default

    I would suggest you figure it out on paper first. For example... you need to know how many rows or how high the triangle should be, so your program can calculate the output of the triangle (so you can calculate the needed blank spaces).
    What your sorta looking for is Pascal's traingle (example heigth is 3):
    Java Code:
      1
     234
    56789
    In the example abaove the first line would be printed with 2 blank spaces and a 1.

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  7. #7
    Sylar's Avatar
    Sylar is offline Member
    Join Date
    Mar 2009
    Location
    Odessa, Texas
    Posts
    16
    Rep Power
    0

    Default

    ***1***
    **234**
    *56789*

    imaging the asterisks as whitespaces...

  8. #8
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    I can't get the question :( Does the guy need a numeric tower or what?

  9. #9
    anteup is offline Member
    Join Date
    Sep 2008
    Posts
    13
    Rep Power
    0

    Default

    if you just want to format numbers on different lines um
    <code>
    system.out.println("1\n");
    system.out.println("2 3\n");
    system.out.println("4 5 6\n");
    system.out.println("7 8 9 10");
    </code>

Similar Threads

  1. Problem with my first Struts program....please help me
    By sireesha in forum Web Frameworks
    Replies: 5
    Last Post: 10-16-2011, 04:19 PM
  2. Help! problem with program (using JFrame)
    By linux1man in forum New To Java
    Replies: 5
    Last Post: 01-21-2009, 08:46 PM
  3. DaysAndMonth program problem Help!!
    By kris09 in forum New To Java
    Replies: 1
    Last Post: 08-04-2008, 06:11 PM
  4. program problem
    By amith in forum AWT / Swing
    Replies: 12
    Last Post: 05-16-2008, 08:07 PM
  5. Problem with First Hibernate program
    By sireesha in forum JDBC
    Replies: 11
    Last Post: 05-05-2008, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •