For an interview in MNC Company and logic.
Best Holo Patterns in java, Best java Patterns Que. in java program, Star pattern in java,character pattern in java, number Pattern in java for learning patterns
Q. Write a Java code for following Holo Pattern.?
Holo Patterns in java program, Star patterns in java , char pattern in java, number Patterns in java
Pattern
*
* *
* *
* *
* *
* * * * *
class holo_1
{
public static void main(String args[])
{
int row , col ;
for (row=1;row<=5;row++)
{
for ( col=1 ; col<=row ; col++ )
{
if ( row==col || row==5 || col==1 )
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}
}
Q. Write a Java code for following Holo Pattern.?
Holo Patterns in java program, Star patterns in java, char patterns in java, number Patterns in java
* * * * *
* *
* *
* *
* *
* *
* *
* * * * *
* *
* *
* *
* *
* *
* *
* * * * *
class holo_2
{
public static void main(String args[])
{
int row , col ;
for ( row=1;row<=15;row++)
{
for ( col=1;col<=6;col++)
{
if( row==1 || row==8 || row==15 || col==1 || col==6)
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}
}
Q. Write a Java code for following Holo Pattern.?
Holo Patterns in java program, Star patterns in java, char patterns in java , number Patterns in java
Pattern
*
* *
* *
* *
* *
* *
* *
* *
*
class holo_3
{
public static void main(String args[])
{
int row ,col;
for (row=1;row<=5;row++)
{
for ( col=5 ; col>=row ; col--)
{
System.out.print(" ");
}
for( col=1 ; col<=row ; col++)
{
if( col==1 || col==row)
{ System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
for(row=1;row<=4;row++)
{
for(col=0;col<=row;col++)
{
System.out.print(" ");
}
for(col=4;col>=row ;col--)
{
if(col==4 || col==row )
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}
}
Q. Write a Java code for following Holo Pattern.?
Holo Patterns in java program, Star patterns in java, char patterns in java, number Patterns in java
Pattern
***************
*************
***********
*********
*******
*****
***
*
class holo_4
{
public static void main(String args[])
{int i,j,k=15;
for( i=1;i<=8;i++)
{
for( j=1;j<i;j++)
{
System.out.print(" ");
}
for( j=1;j<=k;j++)
{
System.out.print("*");
}
k=k-2;
System.out.println();
}
}
}
Q. Write a Java code for following Holo Pattern.?
Holo Patterns in java program, Star patterns in java, char patterns in java, number Patterns in java
*****
* *
* *
* *
*****
class holo_5
{
public static void main(String args[])
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=6;j++)
{
if(j==1 || i==1 ||i==5 || (i==2 && j==6)||(i==3&&j==6)||(i==4&&j==6))
{
System.out.print("*");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}
}
Q. Write a Java code for following Holo Pattern.?
Holo Patterns in java program , Star pattern in java ,char pattern in java, number Pattern in java
* *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* *
class holo_6
{
public static void main(String args[])
{
int i,j;
for(i=1;i<=16;i++)
{
for(j=1;j<=16;j++)
{
if(j==1 || j==16 || i==j || (i+j==17))
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}
}
Q. Write a Java code for following Holo Pattern.?
Holo Patterns in java program , Star patterns in java, char pattern in java, number Patterns in java
* * * * * * * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* * * * * * * * * * * * * *
class holo_7
{
public static void main(String args[])
{
int i,j;
for(i=1;i<=16;i++)
{
for(j=1;j<=16;j++)
{
if(i==1|| i==16 || i==j || (i+j==17))
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}
}
Best Holo Patterns in java, Best java Patterns Que. in java program, Star pattern in java,character pattern in java, number Pattern in java for learning patterns
Q. Write a Java code for following Holo Pattern.?
* * * * * * * *
* *
* *
* *
* *
* *
* *
* *
*
* *
* *
* *
* *
* *
* *
* *
* *
* * * * * * * *
class holo_8
{
public static void main(String args[])
{
int i,j;
for(i=1;i<=9;i++)
{ for(j=1;j<=10-i;j++)
{
if(i==1 || j==1 || (i+j==10))
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
for(i=2;i<=10;i++)
{ for(j=1;j<=i;j++)
{
if(i==10 || j==1 || (i==j))
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}
}
Q. Write a Java code for following Holo Pattern.?
*
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
class holo_9
{
public static void main(String args[])
{
int i,j;
for(i=1;i<=9;i++)
{ for(j=1;j<=i;j++)
{
if(j==1 || i==j)
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
for(i=1;i<=9;i++)
{ for(j=1;j<=9-i;j++)
{
if( i+j==9|| j==1)
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}
}
Q. Write a Java code for following Holo Pattern.?
*
* *
* *
* *
* *
* *
* *
* * * * * * *
class holo_10
{
public static void main(String args[])
{
int i,j;
for(i=1;i<=8;i++)
{
for(j=1;j<=8-i;j++)
{
System.out.print(" ");
}
for(j=1;j<=i;j++)
{
if (j==1 || i==8 || i==j)
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}
}
Q. Write a Java code for following Holo Pattern.?
* * * * * *
* *
* *
* *
* *
* *
*
class Holo_11
{
public static void main(String args[])
{
int i,j;
for(i=1;i<=8;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(" ");
}
for(j=1;j<=8-i;j++)
{
if (j==1 || i==1 || i+j==8)
{
System.out.print("* ");
}
else
{
System.out.print(" ");
}
}
System.out.print("\n");
}
}
}