0% found this document useful (0 votes)
31 views5 pages

Pattern Shape

Uploaded by

bernardmarcella1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views5 pages

Pattern Shape

Uploaded by

bernardmarcella1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Public class LoopExample3 {

Public static void main(String[] args) {

Int term = 6;

For (int I = 1; I <= term; i++) {

For (int j = 1; j <= I; j++) {

System.out.print(“*”);

System.out.println();

For (int I = term – 1; I >= 1; i--) {

For (int j = 1; j <= I; j++) {

System.out.print(“*”);

System.out.println();

public class LoopExample3 {

public static void main(String[] args) {


int term = 6;

for (int i = 1; i <= term; i++) {

for (int j = term; j > i; j--) {

System.out.print(" ");

for (int k = 1; k <= i; k++) {

System.out.print("*");

System.out.println();

for (int i = term - 1; i >= 1; i--) {

for (int j = term; j > i; j--) {

System.out.print(" ");

for (int k = 1; k <= i; k++) {

System.out.print("*");

System.out.println();

}
Public class TrianglePattern {

Public static void main(String[] args) {

Int term = 6;

For (int I = 1; I <= term; i++) {

For (int j = term; j > I; j--) {

System.out.print(“ “);

For (int k = 1; k <= (2 * I – 1); k++) {

System.out.print(“*”);

System.out.println();

Public class InvertedTrianglePattern {

Public static void main(String[] args) {

Int term = 6;

For (int I = term; I >= 1; i--) {

For (int j = term; j > I; j--) {

System.out.print(“ “);
}

For (int k = 1; k <= (2 * I – 1); k++) {

System.out.print(“*”);

System.out.println();

Public class DiamondPattern {

Public static void main(String[] args) {

Int term = 6;

For (int I = 1; I <= term; i++) {

For (int j = term; j > I; j--) {

System.out.print(“ “);

For (int k = 1; k <= (2 * I – 1); k++) {

System.out.print(“*”);

System.out.println();

For (int I = term – 1; I >= 1; i--) {


For (int j = term; j > I; j--) {

System.out.print(“ “);

For (int k = 1; k <= (2 * I – 1); k++) {

System.out.print(“*”);

System.out.println();

You might also like