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.
Also See:   Program for Merge Sort in C

Check Also

How to find inverse of a matrix in C programming?

In order to find inverse of a matrix in C programming, you need to know ...

Leave a Reply

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