Telegram Group & Telegram Channel
34. Number pattern 9.

1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1


class PrintPattern
{
public static void main(String args[])
{
int n = 5;
for (int i = 1; i <= n; i++)
{
int j = n - i;
while (j > 0)
{
System.out.print(" ");
j--;
}

j = 1;
while (j <= i)
{
System.out.print(" " + j);
j++;
}

j = i - 1;
while (j > 0)
{
System.out.print(" " + j);
j--;
}

j = n - i;
while (j > 0)
{
System.out.print(" ");
j--;
}
System.out.println();
}
}
}

@java_codings



tg-me.com/java_codings/46
Create:
Last Update:

34. Number pattern 9.

1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1


class PrintPattern
{
public static void main(String args[])
{
int n = 5;
for (int i = 1; i <= n; i++)
{
int j = n - i;
while (j > 0)
{
System.out.print(" ");
j--;
}

j = 1;
while (j <= i)
{
System.out.print(" " + j);
j++;
}

j = i - 1;
while (j > 0)
{
System.out.print(" " + j);
j--;
}

j = n - i;
while (j > 0)
{
System.out.print(" ");
j--;
}
System.out.println();
}
}
}

@java_codings

BY Advance Java πŸ‘¨β€πŸ’»


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/java_codings/46

View MORE
Open in Telegram


Advance Java ‍ Telegram | DID YOU KNOW?

Date: |

How Does Telegram Make Money?

Telegram is a free app and runs on donations. According to a blog on the telegram: We believe in fast and secure messaging that is also 100% free. Pavel Durov, who shares our vision, supplied Telegram with a generous donation, so we have quite enough money for the time being. If Telegram runs out, we will introduce non-essential paid options to support the infrastructure and finance developer salaries. But making profits will never be an end-goal for Telegram.

Mr. Durov launched Telegram in late 2013 with his brother, Nikolai, just months before he was pushed out of VK, the Russian social-media platform he founded. Mr. Durov pitched his new appβ€”funded with the proceeds from the VK saleβ€”less as a business than as a way for people to send messages while avoiding government surveillance and censorship.

Advance Java ‍ from us


Telegram Advance Java πŸ‘¨β€πŸ’»
FROM USA