Pattern Programming:
Pattern programming is a series of program which may contain curtain pattern having an output into the form like shapes of triangle,diamond,kites,square,rectangle and many more.
Below is some of the example of Pattern :
//Pattern Programming : Program of Kites from Java
Compile Java program by using command javac Pattern.java
Run this program by using command java Pattern.java
See the Output :
If you want some more pattern output then just mail me @ nihalcse@gmail.com
Pattern programming is a series of program which may contain curtain pattern having an output into the form like shapes of triangle,diamond,kites,square,rectangle and many more.
Below is some of the example of Pattern :
//Pattern Programming : Program of Kites from Java
class Pattern
{
public static void main(String args[])
{
int no=4;
for(int i=0;i<no;i++)
{
for(int k=no;k>i;k--)
{
System.out.print(" ");
}
for(int j=0;j<=i;j++)
{
System.out.print("* ");
}
System.out.print("\n");
}
for(int i=no;i>=0;i--)
{
for(int k=no;k>i;k--)
{
System.out.print(" ");
}
for(int j=0;j<=i;j++)
{
System.out.print("* ");
}
System.out.print("\n");
}
for(int i=1;i<no;i++)
{
for(int k=no;k>i;k--)
{
System.out.print(" ");
}
for(int j=0;j<=i;j++)
{
System.out.print("* ");
}
System.out.print("\n");
}
}
}
Save this program as Pattern.java{
public static void main(String args[])
{
int no=4;
for(int i=0;i<no;i++)
{
for(int k=no;k>i;k--)
{
System.out.print(" ");
}
for(int j=0;j<=i;j++)
{
System.out.print("* ");
}
System.out.print("\n");
}
for(int i=no;i>=0;i--)
{
for(int k=no;k>i;k--)
{
System.out.print(" ");
}
for(int j=0;j<=i;j++)
{
System.out.print("* ");
}
System.out.print("\n");
}
for(int i=1;i<no;i++)
{
for(int k=no;k>i;k--)
{
System.out.print(" ");
}
for(int j=0;j<=i;j++)
{
System.out.print("* ");
}
System.out.print("\n");
}
}
}
Compile Java program by using command javac Pattern.java
Run this program by using command java Pattern.java
See the Output :
If you want some more pattern output then just mail me @ nihalcse@gmail.com