JAVA - How To Create A Program To Print Equilateral Triangle Star Program In Java
In This Java Code We Will See How To Make A Program To Print A Equilateral Triangle Using For Loop In Java Programming Language.
Source Code:
package javaapp;
public class Woirk {
public static void main(String[] args){
//20 = how much lines
for(int i = 1; i <= 20; i++)
{
//loop to print stars
for(int t = 1; t <= i; t++)
{
System.out.print("*");
}
//create a new Line
System.out.println();
}
}
}
Source Code:
package javaapp;
public class Woirk {
public static void main(String[] args){
//20 = how much lines
for(int i = 1; i <= 20; i++)
{
//loop to print stars
for(int t = 1; t <= i; t++)
{
System.out.print("*");
}
//create a new Line
System.out.println();
}
}
}
//////////OUTPUT:
Equilateral Triangle Star Program In Java |