zafienas / SSK3100-G14

0 stars 0 forks source link

1) Nested Loops (Four Patterns) #13

Closed zafienas closed 3 years ago

zafienas commented 3 years ago

Question:

image

Submission:

  1. Java source code
  2. Screenshot of the output
nadiahisml commented 3 years ago
//Developer: Nadiah Ismail
//Task: Display Pattern A

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

        final int ROW = 6;

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

image

//Developer: Nadiah Ismail
//Task: Display Pattern B

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

        final int ROW = 1;

        for (int i = 6; i >= ROW; i--) {
            for (int j = 1; j <= i; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
}

image

//Developer: Nadiah Ismail
//Task: Display Pattern C

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

        final int ROW = 6;

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

image

//Developer: Nadiah Ismail
//Task: Display Pattern D

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

        final int ROW = 6;

        for (int i = ROW; i >= 1; i--) {
            for (int j = ROW; j > i; j--) {
                System.out.print("  ");
            }
            for (int k = 1; k <= i; k++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

image

WanNurfarah commented 3 years ago

JAVA SOURCE CODE

//Developer: Wan Nurfarah Binti Wan Zulkifli
//Task: Display Pattern A
public class PatternA {
    public static void main(String[] args) {

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

OUTPUT PATTERN A

PA(43)

JAVA SOURCE CODE

//Developer: Wan Nurfarah Binti Wan Zulkifli
//Task: Display Pattern B
public class PatternB {
    public static void main(String[] args) {

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

OUTPUT PATTERN B

PB(44)

JAVA SOURCE CODE

//Developer: Wan Nurfarah Binti Wan Zulkifli
//Task: Display Pattern C
public class PatternC {
    public static void main(String[] args) {

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

OUTPUT PATTERN C

PC(45)

JAVA SOURCE CODE

//Developer: Wan Nurfarah Binti Wan Zulkifli
//Task: Display Pattern D
public class PatternD {
    public static void main(String[] args) {

        for(int i = 1; i <= 6; i++) {
            for(int k = i; k > 1; k--) {
                System.out.print("  ");
            }
            for(int j = 1; j <= 7 - i; j++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

OUTPUT PATTERN D

PD(46)
Syazimah06 commented 3 years ago
//Developer: SITI NUR SYAZIMAH BINTI ABU (203023)
//Task: Pattern A

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

        int counter = 6;

        for(int i = 1; i <= counter; ++i){
            for(int j = 1; j <= i; ++j){
                System.out.print("* ");
            }
            System.out.print("\n");
        }
    }
}

PatternA

//Developer: SITI NUR SYAZIMAH BINTI ABU (203023)
//Task: Pattern B

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

        int counter = 6;

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

PatternB

//Developer: SITI NUR SYAZIMAH BINTI ABU (203023)
//Task: Pattern C

public class PatternC {
    public static void main(String[] args) {
        int counter = 6, j;

        for(int i = 0; i < counter; i++)
        {
            for(j = 2*(counter - i); j >= 0; j--)
            {
                System.out.print(" ");
            }
            for(j = 0; j<=i; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
}

PatternC

//Developer: SITI NUR SYAZIMAH BINTI ABU (203023)
//Task: Pattern D

public class PatternD {
    public static void main(String[] args) {
        int counter = 1;

        for(int i = 6; i >= counter; i--)
        {
            for(int j = 6; j >= i; j--)
            {
                System.out.print(" ");
            }
            for(int k = 1; k <= i; k++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}

PatternD

FarhanaYusri commented 3 years ago
//Developer : Farhana Yusri
//Task : Pattern A

public class PatternLoop {

    public static void main (String [] args) {

        for (int r= 0; r<=6; r++) {

                for(int c= 0; c<r; c++ ){

                    System.out.print("* ");
                }
            System.out.println();

        }
    }
}

Pattern A

//Developer : Farhana Yusri
//Task : Pattern B

public class PatternLoop {

    public static void main (String [] args) {

        for (int r= 6; r>=1; r--) {

                for(int c= 1; c<=r; c++ ){

                    System.out.print("* ");
                }
            System.out.println();

        }
    }
}

Pattern B


//Developer : Farhana Yusri
//Task : Pattern C

public class PatternLoop {

    public static void main(String[] args) {

        int r,n=6,c;

        for( r=0; r<n; r++)
        {
            for( c=2*(n-r); c>=0; c--)
            {
                System.out.print(" ");
            }
            for(c=0; c<=r; c++)
            {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
}

Pattern C

//Developer: Farhana Yusri
//Task: Pattern D
public class Loop {

    public static void main(String[] args) {

        final int r = 6;

        for (int i = r; i >= 1; i--) {
            for (int c = r ; c > i; c--) {
                System.out.print("  ");
            }
            for (int k = 1; k <= i; k++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

D

Farhanazul98 commented 3 years ago

Pattern A

//Developer: me98
public class PatternA {
    public static void main (String [] args ) {

        int rows = 6;
        System.out.println("Pattern A" );

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

image

Pattern B

//developer:me
public class PatternB {
    public static void main (String [] args) {

        //enter how many rows wanted as output
        int rows = 6;
        System.out.println("Pattern B" );

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

image

Pattern C

//Developer Farhanazul
public class TryPatternC {
    public static void main (String [] args ) {
        int rows = 6;
        System.out.println("Pattern C");

        for (int i = 1; i <= rows; ++i) {
            for (int space = 1; space <= rows - i; ++space) {
                System.out.print("  ");
            }

                for(int j = 2 * i - 1; j >= i; --j) {
                System.out.print("* ");
            }

            System.out.println();
        }

    }
}

image

Pattern D

//Developer: me fzul
public class TryPatternD {
    public static void main (String [] args) {
    int rows = 6;
    System.out.println("Pattern D");

    for(int i = rows; i >= 1; --i) {
        for(int space = 1; space <= rows - i; ++space) {
            System.out.print("  ");
        }

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

image

FtyRzd commented 3 years ago

Pattern A

//Developer : Siti Nurfatihah bt Rozaidi (202934)
//Task : Lab4PatternA

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

        for (int i = 0; i <= 6; i++) {
            for (int j = 0; j < i; j++) {
                System.out.print(" * ");
            }
            System.out.println();

            }
        }
    }

image Pattern B

//Developer : Siti Nurfatihah bt Rozaidi (202934)
//Task : Lab4PatternB

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

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

image

Pattern C

//Developer : Siti Nurfatihah bt Rozaidi (202934)
//Task : Lab4PatternC
public class PatternC {
    public static void main(String[] args) {
        int i , j ;
        int n=6;

        for( i=0; i<n; i++)
        {
            for( j=2*(n-i); j>=0; j--)
            {
                System.out.print(" ");
            }
            for(j=0; j<=i; j++)
            {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
}

image

Pattern D

//Developer : Siti Nurfatihah bt Rozaidi (202934)
//Task : Lab4PatternD
public class PatternD {
    public static void main(String[] args) {

        int i,j,k;

        for( i = 1; i <= 6; i++) {
            for( k = i; k > 1; k--) {
                System.out.print("  ");
            }
            for(j = 1; j <= 7 - i; j++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

image

Masturah29 commented 3 years ago
// Developer : Masturah Binti Mokhtar
// Task : Pattern

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

        System.out.println("\n\nPattern A");
        for (int i = 1; i <= 6; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }

        System.out.println("\n\nPattern B");
        for (int i = 1; i <= 6; i++) {
            for (int j = 1; j <= 7 - i; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }

        System.out.println("\n\nPattern C");
        for (int i = 1; i <= 6; i++) {
            for (int k = 1; k <= 6 - i; k++) {
                System.out.print("  ");
            }
            for (int j = 1; j <= i; j++) {
                System.out.print("* ");
            }
            System.out.println(); }

        System.out.println("\n\nPattern D");
        for (int i = 1; i <= 6; i++) {
            for (int k = i; k > 1; k--)
            {
                System.out.print("  ");
            }
            for (int j = 1; j <= 7 - i; j++) {
                System.out.print("* ");}
            System.out.println(); }
    }

    }

pattern1

pattern2

nrhzrhrsli commented 3 years ago

//Display: Hazirah Rosli
//Task: Display Pattern A

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

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

image

//Developer: Hazirah Rosli
//Task: Dislpay Pattern B

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

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

image

//Developer: Hazirah Rosli
//Task: Display Pattern C

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

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

image

//Developer : Hazirah Rosli
//Task: Dislpay Pattern D

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

        for(int i = 1; i <= 6; i++){
            for(int k = i; k > 1; k--){
                System.out.print("  ");   // guna print kalau nak buat pyramid
            }
            for(int j = 1; j <= 7-i; j++){
                System.out.print(" *");
            }
            System.out.println();         // luar guna println
        }
    }
}

image

DenzKaizer commented 3 years ago
//Danish 204596
//Pattern A
public class Pattern_A {
    public static void main (String [] args){

        final int ROW = 6;

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

Screenshot_5

//Danish 204596
//Pattern B
public class Pattern_B {
    public static void main(String[] args) {

        final int ROW = 1;

        for (int i = 6; i >= ROW; i--) {
            for (int j = 1; j <= i; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
}

Screenshot_6

//Danish 204596
//Pattern C
public class Pattern_C {
    public static void main(String[] args) {

        final int ROW = 6;

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

Screenshot_7

//Danish 204596
//Pattern D
public class Pattern_D {
    public static void main(String[] args) {

        final int ROW = 6;

        for (int i = ROW; i >= 1; i--) {
            for (int j = ROW; j > i; j--) {
                System.out.print("  ");
            }
            for (int k = 1; k <= i; k++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

Screenshot_8

NurHanisHaziqah commented 3 years ago
//Developer: NUR HANIS HAZIQAH BINTI HISHAM HAIZAD(202936)
//TASK : PATTERN A

package com.company;

public class PatternA {
    public static void main(String[] args) {
        for(int i = 1; i <= 6; ++i){
            for(int j = 1; j <= i; j++) {
                System.out.print( " * ");
            }
            System.out.print("\n");
        }
    }
}

Screenshot_111

//Developer: NUR HANIS HAZIQAH BINTI HISHAM HAIZAD(202936)
//TASK : PATTERN B

package com.company;

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

Screenshot_137

//Developer: NUR HANIS HAZIQAH BINTI HISHAM HAIZAD(202936)
//TASK :  PATTERN C

package com.company;

public class PatternC {
    public static void main(String[] args) {
        for(int i=6; i >= 1 ;i--) {

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

            for (int k = 6; k >= i; k--)
            {
                System.out.print(" * ");
            }
            System.out.println();
        }
    }
    }

Screenshot_138

//Developer: NUR HANIS HAZIQAH BINTI HISHAM HAIZAD(202936)
//TASK : PATTERN D

package com.company;

public class PatternD {
    public static void main(String[] args) {
         for(int i = 6; i >=1; i-- ){

             for(int k = 6; k >= i; k--)
            {
                System.out.print( "   ");
            }
            for(int j = 1 ; j<=i;j++)
            {
                System.out.print( " * ");
            }
             System.out.println();
         }
        }
    }

Screenshot_139

NoorHusna202271 commented 3 years ago
//Developer: Noor Husna
//Task: Display Pattern A

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

        final int ROW = 6;

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

image

//Developer: Noor Husna
//Task: Display Pattern B

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

        final int ROW = 1;

        for (int i = 6; i >= ROW; i--) {
            for (int j = 1; j <= i; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
}

image

//Developer: Noor Husna
//Task: Display Pattern C

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

        final int ROW = 6;

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

image

//Developer: Noor Husna
//Task: Display Pattern D
public class PatternD {
    public static void main(String[] args) {

        final int ROW = 6;

        for (int i = ROW; i >= 1; i--) {
            for (int j = ROW; j > i; j--) {
                System.out.print("  ");
            }
            for (int k = 1; k <= i; k++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

image

izzatisyahzanani16 commented 3 years ago

// Developer : Nurul Izzati Syahzanani Binti Farooq Azam
// Task : Nested Loops (Lab 4)

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

        patternA();
        patternB();
        patternC();
        patternD();
    }

    public static void patternA() {
        System.out.println("Pattern A");
        int counter = 6;

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

    public static void patternB() {
        System.out.println("Pattern B");
        int counter = 6;

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

    public static void patternC() {
        System.out.println("Pattern C");
        int counter = 6;

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

    public static void patternD() {
        System.out.println("Pattern D");
        int counter = 6;

        for (int i = counter; i >= 1; i--) {
            for (int j = counter; j > i; j--) {
                System.out.print("  ");
            }
            for (int k = 1; k <= i; k++) {
                System.out.print(" *");
            }
            System.out.println();
        }
        System.out.println("--------------------------------------");
    }
}

image image

AzimArifin commented 3 years ago

//Developer: Azim
//Task: Star Pyramid 1

public class NumberPractice2 {

    public static void main(String[] args) {
        int lines= 6;

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

//Developer: Azim
// Task: Number pyramid 2
public class NumberPractice3 {
    public static void main(String[] args) {

        int lines = 6;

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

// Developer: Azim
// Task: Pyramid number 3
public class NumberPractice4 {
    public static void main(String[] args) {

        final int lines = 6;

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

// Developer: Azim
// Task: Number pyramid 4

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

        int line =6;

        for
            (int i = 1; i <= 6; i++) {
            for(int k = i; k > 1; k--) {
                System.out.print("  ");
            }
            for(int h = 1; h <= 7 - i; h++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}
AzimArifin commented 3 years ago

Screenshot_1 Screenshot_2 Screenshot_3 Screenshot_4

elyamaisarah commented 3 years ago
//developer: Elya Maisarah (202487)
//Task: Pattern A
public class Question1 {
    public static void main(String[] args) {

        int rows = 6;

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

    }
}

PATTERN A

//developer: Elya Maisarah (202487)
//Task: Pattern B
public class patternB {
    public static void main(String[] args) {

        int rows = 6;

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

    }
}

Pattern B

//developer:Elya Maisarah (202487)
//Task: Pattern C
public class patternC {
    public static void main(String[] args) {

        int rows = 6;

        for (int i = 1; i <= rows; i++) {
            for( int j=2*(rows-i); j>=0; j--) {
                System.out.print(" ");
            }
            for(int j=1; j<=i; j++) {
                System.out.print("* ");
            }
            System.out.println();
           }
        }

    }

Pattern C

//developer:Elya Maisarah (202487)
//Task: Pattern D
public class patternD {
    public static void main(String[] args) {
        int rows = 6;
        for (int i = rows; i >= 1; i--) {

            for (int j=2*(rows-i); j>=0; j--) {
                System.out.print(" ");
            }
            for (int j = 1; j <= i; j++) {

                System.out.print("* ");
            }
            System.out.println();
        }
    }
}

Pattern D

azeelahyasmin00 commented 3 years ago

Pattern A

// Developer : Azeelah Yasmin Bt Azlee
// Task : Pattern A

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

        for(int i=1; i <=6; i++){
            for(int j =1;j<=i; j++){
                System.out.print(" * ");
            }
            System.out.println("\n");
        }

    }
}

image

//Developer : Azeelah Yasmin Bt Azlee
// Task : Pattern B

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

image

//Developer : Azeelah Yasmin Bt Azlee
//Task : Task C

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

        final int row = 6;
        for( int i = 1; i <= row; i++){
            for(int j = 1; j <= row - i; j++){
                System.out.print("  ");
            }
            for(int j = 1; j <= i; j++){
                System.out.print(" *");
            }
            System.out.println();
        }

    }
}

image

//Developer : Azeelah Yasmin Bt Azlee
//Task : Task D

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

        final int row = 6;
        for( int i = row; i >= 1; i--){
            for(int j = row; j > i; j--){
                System.out.print("  ");
            }
            for(int j = 1; j <= i; j++){
                System.out.print(" *");
            }
            System.out.println();
        }

    }
}

image

fakhiraadriana commented 3 years ago
//Developer name=Nur Fakhira Adriana
public class soalan1 {
    public static void main(String[] strings) {

        System.out.println("\n\nPattern A");
        for (int i = 1; i <= 6; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(" * ");
            }
            System.out.println();
        }

        System.out.println("\n\nPattern B");
        for (int i = 1; i <= 6; i++) {
            for (int j = 1; j <= 7 - i; j++) {
                System.out.print(" * ");
            }
            System.out.println();
        }

        System.out.println("\n\nPattern C");
        for (int i = 1; i <= 6; i++) {
            for (int k = 1; k <= 6 - i; k++) {
                System.out.print("   ");
            }

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

        }

        System.out.println("\n\nPattern D");
        for (int i = 1; i <= 6; i++) {
            for (int k = i; k > 1; k--) {
                System.out.print("   ");
            }
            for (int j = 1; j <= 7 - i; j++) {
                System.out.print(" * ");
            }
            System.out.println();
        }
    }
}

Screenshot (165) Screenshot (166)

ajim1619 commented 3 years ago

//Developer: Abdul Azim (203198)
//Task: Display Pattern A,B,C,D

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

        // Pattern A

        System.out.println("'Pattern A'");
        for (int x = 0;  x <= 6; x++) {
            for(int y = 0; y < x; y++ ){
                    System.out.print(" * ");
                }
                System.out.println();
        }

        // Pattern B
        System.out.println("\n 'Pattern B' ");
        for(int x = 1; x <= 6; x++) {
            for(int y = 1; y <= 7 - x; y++) {
                System.out.print(" * ");
            }
            System.out.println();
        }

        // Pattern C
        System.out.println("\n 'Pattern C' ");
        for(int x = 1; x <= 6; x++) {
            for(int y = 1; y <= 6 - x; y++) {
                System.out.print("  ");
            }
            for(int y = 1; y <= x; y++) {
                System.out.print(" *");
            }
            System.out.println();
        }

        // Pattern D
        System.out.println("\n 'Pattern D' ");
        for(int x = 1; x <= 6; x++) {
            for(int y = 1; y > x - x; y--) {
                System.out.print("  ");
            }
            for(int z = 1; z <= 7 - x; z++) {
                System.out.print(" *");
            }
            System.out.println();
        }

    }
}

![Pattern ABCD](https://user-images.githubusercontent.com/25761177/102567687-034a7380-411d-11eb-8937-1102c4341727.JPG)
haswani203024 commented 3 years ago
//Developer: Nurul Haswani Bt Ariffin
//Matric: 203024

public class patternA {

    public static void main (String [] args){

        final int ROW = 6;

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

image

//Developer: Nurul Haswani Bt Ariffin
//Matric: 203024

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

        final int ROW = 1;

        for (int i = 6; i >= ROW; i--) {
            for (int j = 1; j <= i; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
}

image

//Developer: Nurul Haswani Bt Ariffin
//Matric: 203024

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

        final int ROW = 6;

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

image

//Developer: Nurul Haswani Bt Ariffin
//Matric: 203024

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

        final int ROW = 6;

        for (int i = ROW; i >= 1; i--) {
            for (int j = ROW; j > i; j--) {
                System.out.print("  ");
            }
            for (int k = 1; k <= i; k++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

image

SorfinaNorly commented 3 years ago

//Developer: Norshasha Sorfina
//Task : Pattern A

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

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

Pattern A Output


//Developer: Norshasha Sorfina
//Task : Pattern B

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

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

Pattern B Output


//Developer: Norshasha Sorfina
//Task : Pattern C

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

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

Pattern C Output


//Developer: Norshasha Sorfina
//Task : Pattern D

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

        for (int i = 1; i <= 6; i++)
        {
            for (int k = 2; k <= i; k++)
            {
                System.out.print("  ");
            }
            for (int j = i; j <= 6; j++)
            {
                System.out.print("*" + " ");
            }
            System.out.println();
        }

    }
}

Pattern D Output

shazmi10 commented 3 years ago
// Developer : Muhammad Shazmi Bin Mohd Basri
// Task : Display Pattern A

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

        final int ROW = 6;

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

image

// Developer : Muhammad Shazmi Bin Mohd Basri
// Task : Display Pattern B

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

        final int ROW = 1;

        for (int i = 6; i >= ROW; i--) {
            for (int j = 1; j <= i; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
}

image

// Developer : Muhammad Shazmi Bin Mohd Basri
// Task : Display Pattern C

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

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

image

// Developer : Muhammad Shazmi Bin Mohd Basri
// Task : Display Pattern D

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

        for(int i = 1; i <= 6; i++) {
            for(int k = i; k > 1; k--) {
                System.out.print("  ");
            }
            for(int j = 1; j <= 7 - i; j++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

image

arifqhuzairie commented 3 years ago
// developer: arif qhuzairie
// task: nested loop 4 pattern
public class patterna {
    public static void main(String[] args) {
        int lines= 6;

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

image

// developer: arif qhuzairie
// task: nested loop 4 pattern
public class patternb {
    public static void main(String[] args) {

        int lines = 6;

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

image

// developer: arif qhuzairie
// task: nested loop 4 pattern
public class patternc {
    public static void main(String[] args) {

        final int lines = 6;

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

image

// developer: arif qhuzairie
// task: nested loop 4 pattern
public class patternd {
    public static void main(String[] args) {

        int line =6;

        for
        (int i = 1; i <= 6; i++) {
            for(int k = i; k > 1; k--) {
                System.out.print("  ");
            }
            for(int h = 1; h <= 7 - i; h++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

image

ikmalhafiq commented 3 years ago

//Developer: Ikmal Hafiq
//Task: Pattern A

public class PatternsA {

    public static void main(String[] args) {
        int lines= 6;

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

Pattern A


//Developer: Ikmal Hafiq
// Task: Pattern B

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

        int lines = 6;

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

Patterns B

// Developer: Ikmal Hafiq
// Task: Pattern C

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

        final int lines = 6;

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

Patterns C


// Developer: Ikmal Hafiq
// Task: Pattern D

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

        int line =6;

        for
        (int i = 1; i <= 6; i++) {
            for(int k = i; k > 1; k--) {
                System.out.print("  ");
            }
            for(int h = 1; h <= 7 - i; h++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

Pattern D

Lyanaazwanis99 commented 3 years ago
/Developer:Lyana Azwanis
//Task: Display pattern A

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

https://prnt.sc/w5dh35

//Developer: Lyana Azwanis
//Task: Display pattern B
public class Nestedloop2 {
    public static void main(String[] args) {

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

https://prnt.sc/w5dj5z

//Developer: Lyana Azwanis
//Task: Display pattern C
public class Nestedloop3 {
    public static void main(String[] args){
        for (int i = 1; i <= 6; i++) {
            for (int k = 1; k <= 6 - i; k++) {
                System.out.print("  ");
            }
            for (int j = 1; j <= i; j++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

https://prnt.sc/w5dmlj

/Developer: Lyana Azwanis
//Task: Display pattern D
public class Nestedloop4 {
    public static void main(String[] args) {

        for(int i = 1; i <= 6; i++) {
            for(int k = i; k > 1; k--) {
                System.out.print("  ");
            }
            for(int j = 1; j <= 7 - i; j++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

https://prnt.sc/w5dnxx

batrisyaalwani commented 3 years ago
package com.company;
//name: batrisya alwani
//task: patternA
public class Main {
    public static void main(String[] args) {

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

Screenshot (111)

package com.company;
//name: batrisya alwani
//task: patternB
public class Main {
    public static void main(String[] args) {

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

Screenshot (113)

package com.company;
//name: batrisya alwani
//task: patternC
public class Main {
    public static void main(String[] args) {

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

Screenshot (115)

package com.company;
//name: batrisya alwani
//task: patternD
public class Main {
    public static void main(String[] args) {

        for(int i = 1; i <= 6; i++) {
            for(int k = i; k > 1; k--) {
                System.out.print("  ");
            }
            for(int j = 1; j <= 7 - i; j++) {
                System.out.print(" *");
            }
            System.out.println();
        }
    }
}

Screenshot (117)