public class pattern16
{
public static void main(String[] args) {
int i,j;
for(i=1; i<=5; i++)
{
System.out.print("\n");
for(int l=5; l>=i; l--)
System.out.print(" ");
for(int k=1; k<=i; k++)
System.out.print("*");
for(j=1; j<=i*2-1; j++)
{
System.out.print("0");
}
for(int c=1; c<=i; c++)
System.out.print("*");
}
}
}
output:
*0*
**000**
***00000***
****0000000****
*****000000000*****
{
public static void main(String[] args) {
int i,j;
for(i=1; i<=5; i++)
{
System.out.print("\n");
for(int l=5; l>=i; l--)
System.out.print(" ");
for(int k=1; k<=i; k++)
System.out.print("*");
for(j=1; j<=i*2-1; j++)
{
System.out.print("0");
}
for(int c=1; c<=i; c++)
System.out.print("*");
}
}
}
output:
*0*
**000**
***00000***
****0000000****
*****000000000*****
No comments:
Post a Comment
SAY HELLO!!