92. 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
import java.util.Scanner;public class pattern
{
public static void main(String args[] )
{
int i,j,n;
System.out.println("Enter no.of rows:\n");
Scanner skill = new Scanner(System.in );
n=skill.nextInt();
for ( i=1;i<=n;i++ )
{
for ( j=n;j>=i;j-- )
{
System.out.print(j);
}
System.out.println("");
}
}
}