pattern
pattern

Pattern 1

111

111

111

111

111

package Patterns;
class pattern
{
public static void main()
    {
for(int i=1;i<=5;i++)
        {
for(int j=1;j<=3;j++)
            {
System.out.print("1");
            }
System.out.println();
    }
}
}

Pattern 2

1

2 3

4 5 6

7 8 9 10

11 12 13 14 15

package Patterns;
class pattern4
{
public static void main()
    {
int k=1;
for(int i=1;i<=5;i++)
        {
for(int j=1;j<=i;j++)
            {
System.out.print(k);
k++;
            }
System.out.println();
    }
}
}

Pattern 3

1

22

333

4444

55555

package Patterns;
class pattern5
{
public static void main()
    {
for(int i=1;i<=5;i++)
         {
for(int j=1;j<=i;j++)
            {
System.out.print(i);
            }
System.out.println();
         }
}
}

Pattern 4

1

21

321

4321

54321

package Patterns;
class pattern9
{
public static void main()
    {
for(int i=1;i<=5;i++)
        {
int k=i;
for(int j=1;j<=i;j++)
            {
System.out.print(k);
k--;
            }
System.out.println();
    }
}
}

Pattern 5

54321

5432

543

54

5

package Patterns;
class pattern7
{
public static void main()
    {
for(int i=1;i<=5;i++)
        {
for(int j=5;j>=i;j--)
            {
System.out.print(j);
            }
System.out.println();
    }
}
}

LEAVE A REPLY

Please enter your comment!
Please enter your name here