Print Equilateral Triangle Of Order n*n In Java
class pattern1{
public static void main(String[] args) {
int spc = 5, str = 1, i, j;
for ( i=1; i<=6; i++ )
{
for ( j=1; j<=spc; j++ )
{
System.out.print(" ");
}
for ( j=1; j<=str; j++ )
{
System.out.print("* ");
}
System.out.println(" ");
spc--;
str++;
}
}
}
Output:
No comments:
Post a Comment