Java program to print triangle pattern program using a symbol

Java program to print triangle pattern program using a symbol. In the Java programming language, a triangle pattern is used.Using the numbers in Java, this program will print the pattern. Although printing the pattern program is easy, doing the same thing with symbols is more difficult for beginners in Java

public class Main
{ 
public static void main(String[] args) 
{ 
for (int i = 0; i <= 5; i++) 
{ 
int letters = 40; 
for (int j = 5; j > i; j--) 
{ 
System.out.print(" "); 
} 
for (int k = 0; k <= i; k++) 
{ 
System.out.print((char) (letters+ k) + " "); 
} 
System.out.println(); 
} 
} 
}

 

Output:                                                                                                                         

    ( )                                                                                                                         

   ( ) *                                                                                                                        

  ( ) * +                                                                                                                       

 ( ) * + ,                                                                                                                      

( ) * + , –