Ques5.)
1
232
34543
4567654
567898765
Ans.)
package numberpattern;
public class pattern5
{
public static void main(String args[])
{
int x=1;
int y=0;
int z=0;
for(int
i=1;i<=5;i++)
{
for(int
k=4;k>=i;k--)
{
System.out.print(" ");
}
for(int
j=x;j<i+x;j++)
{
System.out.print(j);
}
if(i>1){
for(int
k=y+z;k>=y+1;k--)
{
System.out.print(k);
}}
y++;
z++;
x++;
System.out.println("");
}
}
}
No comments:
Post a Comment