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