Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #25258

Re: Creating a diamond shape wtih java

X-Received by 10.66.188.37 with SMTP id fx5mr2538pac.45.1378656052203; Sun, 08 Sep 2013 09:00:52 -0700 (PDT)
X-Received by 10.49.133.225 with SMTP id pf1mr583857qeb.6.1378656052144; Sun, 08 Sep 2013 09:00:52 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!b4no4529364pbq.1!news-out.google.com!rn2ni68054pbc.1!nntp.google.com!b4no4529361pbq.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Sun, 8 Sep 2013 09:00:51 -0700 (PDT)
In-Reply-To <ccc6b9c6-617f-4a17-b14c-9dab366d9025@googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=24.129.109.128; posting-account=L3GIDwoAAAAVaWFoxfZ2m8N6zVIr0Vqh
NNTP-Posting-Host 24.129.109.128
References <ccc6b9c6-617f-4a17-b14c-9dab366d9025@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <602cd444-c24d-4144-b4ea-2a8d6a9558bf@googlegroups.com> (permalink)
Subject Re: Creating a diamond shape wtih java
From John Stephens <johnnyringo888@gmail.com>
Injection-Date Sun, 08 Sep 2013 16:00:52 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.java.programmer:25258

Show key headers only | View raw


On Wednesday, September 4, 2013 8:15:53 PM UTC-4, John Stephens wrote:
> I have to create a diamond shape for my java class.
> 
> 
> 
>      *
> 
>     ***
> 
>    *****
> 
>   *******
> 
>  *********
> 
>   *******
> 
>    *****
> 
>     ***
> 
>      *
> 
> 
> 
> Here is the code I have written so far. Can any provide assistance?
> 
> 
> 
> 
> 
> 
> 
> public class Diamond
> 
> {
> 
> 	public static void main (String[] args)
> 
> 	{
> 
> 	 for ( int i = 1; i <= 10; i++ )
> 
>          {
> 
>             for ( int j = 0; j < i; j++ )
> 
>             {
> 
> 	       System.out.print ("*");
> 
>             }
> 
>             {  
> 
>                System.out.println ("\n");
> 
>             }   
> 
>          }
> 
> 	
> 
> 	 for ( int i = 10; i > 0; i-- )
> 
> 	 {
> 
> 	    for ( int j = 0; j < i; j++ )
> 
> 	    {
> 
> 	       System.out.print ("*");
> 
>             }
> 
>             {  
> 
>                System.out.println ("\n");
> 
>             }   
> 
>          }
> 
> 
> 
> 	 for ( int i = 10; i > 0; i-- )
> 
>          {
> 
>             for ( int j = 0; j < (10 - i); j++ )
> 
> 				{
> 
> 	        System.out.print (" ");
> 
>             }            }
> 
>             for ( int j = 0; j < i; j++ )	
> 
> 		      {
> 
>                System.out.print ("*");
> 
>             }
> 
>             {  
> 
>                System.out.println ("\n");
> 
>             }   
> 
>  	      }
> 
>       
> 
>       for ( int i = 1; i <= 10; i++ )
> 
>          {
> 
>             for ( int j = 0; j < (10 - i); j++ );
> 
>             { 
> 
>                System.out.print (" ");
> 
>             }      
> 
> 	    for ( int j = 0; j < i; j++ );
> 
> 	    {
> 
> 	       System.out.print ("*");
> 
>   	    }
> 
>             {  
> 
>                System.out.println ("\n");
> 
>             }
> 
>          }   
> 
>    }
> 
> }
> 
> 
> 
> When I compile this is what I get:
> 
> 
> 
> *
> 
> 
> 
> **
> 
> 
> 
> ***
> 
> 
> 
> ****
> 
> 
> 
> *****
> 
> 
> 
> ******
> 
> 
> 
> *******
> 
> 
> 
> ********
> 
> 
> 
> *********
> 
> 
> 
> **********
> 
> 
> 
> **********
> 
> 
> 
> *********
> 
> 
> 
> ********
> 
> 
> 
> *******
> 
> 
> 
> ******
> 
> 
> 
> *****
> 
> 
> 
> ****
> 
> 
> 
> ***
> 
> 
> 
> **
> 
> 
> 
> *
> 
> 
> 
> **********
> 
> 
> 
>  *********
> 
> 
> 
>   ********
> 
> 
> 
>    *******
> 
> 
> 
>     ******
> 
> 
> 
>      *****
> 
> 
> 
>       ****
> 
> 
> 
>        ***
> 
> 
> 
>         **
> 
> 
> 
>          *
> 
> 
> 
>          *
> 
> 
> 
>         **
> 
> 
> 
>        ***
> 
> 
> 
>       ****
> 
> 
> 
>      *****
> 
> 
> 
>     ******
> 
> 
> 
>    *******
> 
> 
> 
>   ********
> 
> 
> 
>  *********
> 
> 
> 
> **********

Thank you all for the hints. I figured this out!!!!!

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Creating a diamond shape wtih java johnnyringo888@gmail.com - 2013-09-04 17:15 -0700
  Re: Creating a diamond shape wtih java Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-09-04 20:33 -0400
    Re: Creating a diamond shape wtih java Roedy Green <see_website@mindprod.com.invalid> - 2013-09-07 14:10 -0700
  Re: Creating a diamond shape wtih java John Stephens <johnnyringo888@gmail.com> - 2013-09-04 17:46 -0700
  Re: Creating a diamond shape wtih java Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-09-05 00:20 -0300
    Re: Creating a diamond shape wtih java Jeff Higgins <jeff@invalid.invalid> - 2013-09-05 03:32 -0400
      Re: Creating a diamond shape wtih java Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-09-05 09:44 -0300
  Re: Creating a diamond shape wtih java John Stephens <johnnyringo888@gmail.com> - 2013-09-08 09:00 -0700

csiph-web