Results 1 to 2 of 2

Thread: [RESOLVED] creating a pattern

  1. #1

    Thread Starter
    Addicted Member dim_kevin_as_human's Avatar
    Join Date
    Oct 2005
    Location
    Wisconsin
    Posts
    183

    Resolved [RESOLVED] creating a pattern

    using for loops in java, how do i create this pattern in the output window?
    you an only use System.out.print('*') and System.out.println()

    *
    **
    ***
    ****
    *****
    ******
    *******
    ********
    *********
    **********
    Dreaming men are haunted men.

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: creating a pattern

    I don't have a compiler available right now, but something like this should work.
    I would really suggest you attempt these kind of things before posting here. You haven't shown any code and it is really just simple math to figure it out.
    Code:
    for(int i = 1; i <= 10;i++){
      for(int x = 1; x <=i;x++){
        System.out.print("*");
      }
      System.out.println();
    }

Posting Permissions

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



Click Here to Expand Forum to Full Width