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