Triangle Example Java Program
Definition
A triangle is a polygon with three edges and three vertices. It is one of the basic shapes in geometry.Triangle Example Program
class Triangle{ public static void main(String[] args){ for (int i = 0; i < 5; i++){ for (int j = 5; j > i; j--){ System.out.print(" "); } for (int k = 1; k <= i + 1; k++) { System.out.print(" *"); } System.out.print("\n"); } } }
Sample Output
Output is: * * * * * * * * * * * * * * *
Pattern Programs
- Left Triangle Example Java Program
- Inverted Left Triangle Example Java Program
- Triangle Example Java Program
- Inverted Triangle Example Java Program
- Pascal Triangle Example Java Program
- Floyd Triangle Example Java Program
- Diamond pattern with Asterick and Space Example Java Program
- M pattern with Asterick and Space Example Java Program
- W pattern with Asterick and Space Example Java Program
Read More Articles
- Multiple Inheritance Using Interface Example Java Program
- Single Inheritance Example Java Program
- Multilevel Inheritance Example Java Program
- Hierarchical Inheritance Example Java Program
- Find all Substrings of a given string Example Java Program
- Create Matrix Example Java Program
- Sum Of Three Numbers Example Java Program
- Heap Sort Example Java Program
- Twin Prime Example Java Program
- Compile Time Polymorphism Example Java Program