08/13/2022
patterns

hello everyone

also here is a so many patterns codes!

today I will show you how we cam a different-different pattern in java and today we show you how to learn pattern code in java.

Before that we should know what is for loop and what is if-else condition without them we can’t learn the pattern still those are not what the loop and if-else connotation they learn first that’s now we are doing a start simple pattern, ok, now open your notepad or NetBeans, first I show you tringle pattern in java let’s start.

Hello friends, we are sharing an Armstrong number code,
if you don’t know what is Armstrong number you have not seen yet, click on our link:-https://learningpoints.in/category/java/

so friends from java to we can do so many activities like games!

NetBeans install link:-https://netbeans.apache.org/download/index.html

hello everyone,

so today I show you how we can make a different-different pattern in java and also today we show you how to learn a pattern code in java.

you make a different-different type code pattern in java by code.

the tringle pattern code is :

first, create a class.

package project1;

public class tringle

{
public static void main(String []args)

{

int
i,j; for(i=1;i<6;i++)

{


for(j=0;j<i;j++)

{

System.out.print("*");

}

System.out.println(
);

}

}

}

so friends here I explain everything

similarly here we taking two-variable j &I then after we did a start for loop

so in this loop, again we taking i=1 and I<6 and i++ so here i=1 condition is true because one is less than 6, and then after it will going an in the next loop so here j=0 then after it will be checked 0<i or not so 0 is a less than 1 then after it will print (*) (*) do will print continuously when do will my number does not do greater than 6

here I show you our final tringle program output

2. How to make a pattern in java.

tringle in reverse format let’s start here we take a two-variable

i &j let’s start.

and now I show you out of reveres tringle

package project1;

public class tringle {
    public static void main(String []args){
        int i,j;
     for(i=1;i<6;i++){
   for(j=6;j>i;j--){
           System.out.print("*");
       }
       System.out.println("");
       }
    }
    }
    

SO here is a output

3. Now I show you how you can luck like 6 pattern

let’s start here we take a three-variable

so friends again we taking a three-variable i and j and k 

so here this is a simple code


package project1

public class
pattern
{
public static void main(String []args) {
int i,j,k;
for(i=1;i<6;i++){ for(j=1;j<5;j++)

{
System.out.print(“*”);
}
System.out.print(“”);
}

for(j=1;j<6;j++){
System.out.print(“”);

for(k=0;k<2;k++)

{

System.out.println(““);

}

}

for(i=1;i<15;i++)

{

for(j=1;j<15;j++)

{

if(i>=2
&& j>=2 && i<14 && j<14)

{

System.out.print(“
“);}

else

{

System.out.print(““);
}

System.out.println();

}

}

}

here I show you output our cod

4. Now I show you how we can draw a box pattern in java by code

so here we taking a three variables

so friends this a box code

package project1;

/ public
class tringle

{

public
static void main(String []args)

{

int
i,j;

for(i=1;i<15;i++)

{

for(j=1;j<60;j++)

{

if(i>=2
&& j>=2 && i<14 && j<59)

{

System.out.print(“
“);}

else

{

System.out.print(““);}

}
System.out.println(“”);

}

}

and here I show you the final output

Leave a Reply

Your email address will not be published.