Monday, August 27, 2012

Playing with Asterisk patterns-6

Java code for getting the following patterns:
Method receives String array with input String XYZ combinations and an integer varaible for the size of the String to be displayed.

X,Y,Z size=3

* *
 *
* *

* *
 *
 *

***
  *
*
***
XYZ, size=7

*   *
 * *
  *
 * *
*   *
*   *
 * *
  *
  *
  *
*****
  *
 *
*
*****

XYZ, Size=9

*      *
 *   *
  * *
   *
  * *
 *   *
*     *
*      *
 *   *
  * *
   *
   *
   *
   *
*******
    *
   *
  *
 *
*******
Java code:




No comments:

Post a Comment