need help!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • riabear123
    New Member
    • Sep 2005
    • 1

    need help!

    I am using jGrasp for a csc class and im very new to it. I forgot my java book at school. can someone please give me a hint on how to do this following program?

    Program 2
    Write a program to display the first 200 multiples of nine. The output should be displayed in rows of 10 values each. For example: row 1 should contain values for 9*1 through 9*10, row 2 should contain values for 9*11 through 9*20, etc. Format the output so that the numbers are aligned in a table.
  • UniDyne
    New Member
    • Oct 2005
    • 18

    #2
    Okay... First off, don't expect to get your assignments done by asking for solutions in a public forum. Since it's almost a month since your post, I'll assume that the assignment is passed and give you the "meat" of the work:

    Code:
    for(int i = 1; i < 20; i++) {
       System.out.println(""); // start new line
       for(int j = 1; j < 10; j++) {
          System.out.print((j*i)*9 + "  "); // print value and spaces
       }
    }
    System.out.println(""); // one last new line

    Comment

    Working...