Ques3. 1 1
12 21
123 321
1234 4321
12345 54321
12345654321
Ans. package
numberpattern;
public class pattern3 {
public static
void main(String args[])
{
for(int
i=1;i<=6;i++)
{
for(int
j=1;j<=i;j++)
{
System.out.print(j);
}
for(int k=4;k>=i;k--)
{
System.out.print(" ");
}
for(int k=5;k>=i;k--)
{
System.out.print(" ");
}
for(int g=i;g>=1;g--)
{
if(g==6)
{
g=5;
}
System.out.print(g);
}
System.out.println("");
}
}
}
No comments:
Post a Comment