Thursday , September 21 2017
Home / Blue J / java program for pattern#12

java program for pattern#12

Java program for pattern with indentation or spacing


This is a simple java program for pattern with indentation.
Indentation in pattern is thus required. This can be done using extra for loop to provide the required indentation per line.

 class format4 
 public static void main(String args[]) 
 int i,j; 
 	System.out.print(' ');
 	for(j=1;j<=i;j++) // Inner For loop for printing values required in output 
	System.out.print(j); // Prining the value of j as this is what needed in output.
	System.out.println(); // New line for changing the row


Pattern 1 12 123 1234
Java program for pattern

Check Also

Program to check Upper Triangular matrix

What is Upper Triangular Matrix?  An upper triangular matrix is a square matrix in which ...

Leave a Reply

Your email address will not be published. Required fields are marked *