Results 1 to 8 of 8

Thread: Print table

  1. #1
    Implode is offline Member
    Join Date
    Aug 2009
    Posts
    50
    Rep Power
    0

    Default Print table

    I have a problem with printing out tables , 2 seperate programs

    1
    1 2
    1 2 3
    1 2 3 4
    1 2 3 4 5
    1 2 3 4 5 6

    1 2 3 4 5 6
    1 2 3 4 5
    1 2 3 4
    1 2 3
    1 2
    1

  2. #2
    steelshark is offline Member
    Join Date
    Aug 2009
    Posts
    25
    Rep Power
    0

    Default

    What is the problem exactly?Can you describe it a bit further in detail? perhaps provide us with the code you already have=)

    Edit: The output you want can be obtained by nesting 2 for loops.perhaps that will help you

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Implode View Post
    I have a problem with printing out tables , 2 seperate programs

    1
    1 2
    1 2 3
    1 2 3 4
    1 2 3 4 5
    1 2 3 4 5 6

    1 2 3 4 5 6
    1 2 3 4 5
    1 2 3 4
    1 2 3
    1 2
    1
    Yes your question is not much clear. You are talking about a table, and send a number pattern here? What's the cimbination of those. Can you explain bit more clearly.

    And also, as steelshark says, if you want to print that above pattern, just think about what loops are doing, for/while....

  4. #4
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    do you know for loop?
    use x++ x-- to work out the program

  5. #5
    Implode is offline Member
    Join Date
    Aug 2009
    Posts
    50
    Rep Power
    0

    Default

    Sorry, by table I meant number pattern. I think it needs to be nested for loops.

    I just dont know where to put the print statement and where to put the println.

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    First make sure you understand the difference between them then. It should be easy to spot where to put which one after that.

  7. #7
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    println is line break, happen at last character of line
    so, at east last looping of inner for loop, you should add println(), or use println(int)

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by r035198x View Post
    First make sure you understand the difference between them then.
    Yep, and understanding the concept is really valued in any case.

Similar Threads

  1. Print the table in struts...
    By makpandian in forum Web Frameworks
    Replies: 1
    Last Post: 09-22-2009, 06:13 PM
  2. how to print out lines in a table- like form?
    By helloworld in forum New To Java
    Replies: 5
    Last Post: 02-10-2009, 09:31 PM
  3. Replies: 0
    Last Post: 07-11-2008, 04:30 PM
  4. Print the text file and print preview them
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-22-2008, 11:04 PM
  5. Print A Pdf
    By Jack in forum Advanced Java
    Replies: 2
    Last Post: 07-02-2007, 05:40 AM

Posting Permissions

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