1
121
12321
1234321
above is out put of the following program
below the program
class pattern_E
{
public static void pattern(int no)
{
int n=1;
for(int p=1;p<=no;p++)
{
for (int i=no;i>=1;i--)
{
System.out.print(" ");
}
System.out.println("");
for(int m=1;m<=p;m++)
{
System.out.print(m);
}
for(int y=p-1;y>=1;y--)
{
System.out.print(y);
}
System.out.println("");
}
}
}
121
12321
1234321
above is out put of the following program
below the program
class pattern_E
{
public static void pattern(int no)
{
int n=1;
for(int p=1;p<=no;p++)
{
for (int i=no;i>=1;i--)
{
System.out.print(" ");
}
System.out.println("");
for(int m=1;m<=p;m++)
{
System.out.print(m);
}
for(int y=p-1;y>=1;y--)
{
System.out.print(y);
}
System.out.println("");
}
}
}
No comments:
Post a Comment