public class PYRAMID {
public static void main(String[] args) {
int x=1,y=1,n=4;
for (int i = 1; i <=n; i++) {
for (int j = n; j >=i; j--)
{
System.out.print(" ");
}
for (int k = 1; k <=x; k++)
{
System.out.print("*");
} x=x+2;
System.out.println("");
}
}
}
/******************* OUT PUT******************************/
*
***
*****
*******
public static void main(String[] args) {
int x=1,y=1,n=4;
for (int i = 1; i <=n; i++) {
for (int j = n; j >=i; j--)
{
System.out.print(" ");
}
for (int k = 1; k <=x; k++)
{
System.out.print("*");
} x=x+2;
System.out.println("");
}
}
}
/******************* OUT PUT******************************/
*
***
*****
*******
No comments:
Post a Comment