what is pattern program:
Java pattern program enhances the coding skill, logic, and looping concepts. It is mostly asked in Java interview to check the logic and thinking of the programmer. We can print a Java pattern program in different designs.
what is the uses:
Pattern programs best means to study the working of looping structures in general purpose programming languages. Its helps beginners visualize how every iteration in a loop works. Also popularly asked in campus placements & job interviews.
program1:Ascending
public class Ascending
{
public static void main(String[] args)
{
int count;
for( count=1; count<=5; count++)
{
for(int i=1; i<=5; i++)
{
System.out.print(i + " " );
}
System.out.println();
}
}
}
output:

program2:Descending
public class Descending
{
public static void main(String[] args)
{
int count;
for( count=1; count<=5; count++)
{
for(int i=5; i>0; i--)
{
System.out.print(i + " " );
}
System.out.println();
}
}
}
output:

program3: vertical
public class Vertical
{
public static void main(String[] args)
{
for( int i=1; i<=5; i++)
{
for( int j=1; j<=5; j++)
{
System.out.print( i+" " );
}
System.out.println();
}
}
}
output:

program4: Rvertical
public class Rvertical
{
public static void main(String[] args)
{
for( int i=10; i>=1; i--)
{
for( int j=10; j>=1; j--)
{
System.out.print( i+" " );
}
System.out.println();
}
}
}
output:

program5: star
public class Star
{
public static void main(String[] args)
{
int i=1;
int j=1;
for(i=1; i<=5; i++)
{
for(j=1; j<=5; j++)
{
System.out.print( " * " );
}
System.out.println();
}
}
}
output:














