Simple Pattern in Java-1

//Java Program displaying a simple pattern

Any kind of patterns can be made in a programming language using for loops.

Here in this program the outer for loop determines the no of rows that we want for the pattern and the inner loop represents the no of columns per row.

We created a pattern which ranges only for five rows.

The pattern we want to generate is






public class Pattern1
	 public static void main(String args[])

		 for(int i=1; i<=5; i++)//loop for rows
			for(int j=1; j<=i; j++)//loop for columns
			 }//inner for

		 }//outer for


Snapshot of the o/p


4 thoughts on “Simple Pattern in Java-1

  1. Hi, thanks a lot for this but there are 4 errors coming for me whilst executing. It says “variable i not found” what do I do?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s