Triangle Pattern
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
class Program1
{
public static void main(String args[])
{
try
{
int i,j,k;
String s;
Scanner sc = new Scanner(System.in);
System.out.println("Enetr the value");
s = sc.nextLine();
int n = Integer.parseInt(s);
for(i=0;i<=n;i++)
{
for(j=0;j<n-i;j++)
{
System.out.print("");
}
for(k=0;k<=i;k++)
{
System.out.print(k+" ");
}
System.out.print("\n");
}
}
catch(NumberFormatException e)
{
System.out.println("Please enter numeric value, try again");
}
}
}