Home / Blue J / Java program for patterns and formats in java/bluej/c/c++

Java program for patterns and formats in java/bluej/c/c++

Java Program for format/pattern making in java/ Bluej
1
23
456
78910
This pattern is also called floyd’s triangle. You can also see Floyds triangle for N rows where n is inputted by user:
class format1
{
public static void main(String args[])
{
int i,j,k=1;
for(i=1;i<5;i++)   // This loop is For number of rows -5
{
for(j=i;j>0;j--)  // this is for columns in each rows(see in the pattern that number of columns depends on the value of i)
System.out.print(k++);
System.out.println(); // changing the line after each ith loop. For new row
}
}
}

OUTPUT:


java program for pattern 12345678910
Tags: pattern making in java, 1 23 456 78910 pattern-format.

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.