Star Pattern Java

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

[0:38 pm, 24/01/2022]: package Star_Pattern;

public class pattern1


{
public static void main(String[] args) {

//*
//*
//*
//*
// 5<=4 5
for(int i=1; i<=4; i++)
{
System.out.println("*");
}

}
[0:38 pm, 24/01/2022]: package Star_Pattern;

public class Pattern2


{
public static void main(String[] args) {

//**
// 5<=4 5
for(int i=1; i<=4; i++)
{
System.out.print("*");
}

//**

}
[0:38 pm, 24/01/2022] Sanjay Sir Velocity: package Star_Pattern;

public class Pattern3


{
//*
//*

public static void main(String[] args) {


// 3<=2 3
for(int i=1; i<=2; i++) //outer for loop--> rows
{ // 4<=3 4
for(int j=1; j<=3; j++) //inner for loop --> cols
{
System.out.print("*");
}
System.out.println();
}

}
[0:38 pm, 24/01/2022]: package Star_Pattern;

public class Pattern4 {


public static void main(String[] args) {

//***
//***
//***
//***

for(int i=1; i<=4; i++)


{
for(int j=1; j<=5; j++)
{
System.out.print("*");
}
System.out.println();
}

}
}
[0:38 pm, 24/01/2022] package Star_Pattern;

public class Pattern5


{
public static void main(String[] args) {

//*
//**
//*

int star =1; //3


// 4<=3 4
for(int i=1; i<=3; i++)
{ //
for(int j=1; j<=star; j++)
{
System.out.print("*");
}
System.out.println();
star++; //4
}

}
[0:38 pm, 24/01/2022] Star_Pattern;

public class Pattern6


{
public static void main(String[] args) {

//**
//*
//**
//*
int star=4;
for(int i=1; i<=4; i++)
{
for(int j=1; j<=star; j++)
{
System.out.print("*");
}
System.out.println();
star--;
}

}
[0:38 pm, 24/01/2022] Star_Pattern;

public class Pattern7


{
public static void main(String[] args) {

//***
//***
//*
//*
int star=7;
for(int i=1; i<=4; i++)
{
for(int j=1; j<=star; j++)
{
System.out.print("*");
}
System.out.println();
star=star-2;
}

}
[0:38 pm, 24/01/2022] Star_Pattern;

public class Pattern8


{
public static void main(String[] args) {

//*
//*
//***
//***

int star =1;

for(int i=1; i<=4; i++)


{
for(int j=1; j<=star; j++)
{
System.out.print("*");
}
System.out.println();
star=star+2; //4
}

You might also like