Warning: mysqli_connect(): (HY000/2002): Connection refused in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 38

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 40

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 41

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 45

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 48

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/programc/public_html/wp-content/plugins/wp-pro-quiz/wp-pro-quiz.php on line 49
java program for pattern with indentation - Get Program Code
Home / Blue J / java program for pattern with indentation

java program for pattern with indentation

 java program for pattern making
     1
    21
   321
  4321

 

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 format3
{
public static void main(String arg[])
{
int i,j,k=1;            //section of code to be implemented in any of Java/ bluej/ c/c++
for(i=1;i<5;i++)
{
for(j=5;j>=i;j--)    // for loop to print the spaces/indentation required for every line before the values required
System.out.print(' ');

for(j=i;j>0;j--)    // after spacing , vales are to be printed
System.out.print(j);

System.out.println();
}
}
}

OUTPUT:

Tags: program for pattern making in bluej, java program for pattern making, c program for pattern / formats.

Check Also

program for display lower triangular matrix in java

What is Lower Triangular Matrix? Lower Triangular Matrix is if all the elements above the main ...

Leave a Reply

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

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.