102. JAVA Program to Print Number triangle.
How does this program work?
- This program is used to print Number Triangle using java.
Here is the code
//To print Triangle Pattern
public class pattern{
public static void main(String args[])
{
int i,j,k;
for(i=1;i<=5;i++)
{
for (j=5;j>=1;j--)
{
if (j<=i)
System.out.print(+i);
else
System.out.print(" ");
}
System.out.print("\n" );
}
}
}