86. JAVA Program to Print Floyd's triangle.
How does this program work?
- This program is used to print Floyd's triangle using Java.
- In this program we are using for loop to print number triangle, number without re assigning.
Here is the code
//To print Floyd's triangle
public class pattern{
public static void main(String args[] )
{
int i,j,k;
k=1;
for(i=1;i< 5;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(k++ );
System.out.print(" " );
}
System.out.print("\n" );
}
}
}