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