Javatpoint Logo
Javatpoint Logo

Swastika Pattern in Java

In this section, we will learn about how we can write the code for Swastika Pattern in Java by using stars or any other special characters and with the user-defined rows and columns. It is one of the most difficult pattern programs to code in Java. In order to get the perfect Swastika, we have to make sure that the user will enter odd numbers for rows and columns because it will be very easy to find the mid of rows and columns.

We will use the 'for' loop to print the Swastika in the following way:

SwastikaPatternExample.java

Output:

Swastika Pattern in Java

Note: The above code is quite tricky to understand, and it is completely designed by using multiple conditional statements. In the above code, we have used a single nested loop for rows and columns.


Next TopicTug of War in Java





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA