Jump to content
Sign in to follow this  
inStar

Alooooo

Recommended Posts

Alopsss... leh mintak tolong x... Cam ne nak kuarkan output cam ni..

1) *

* *

* * *

* * * *

* * * * *

2) * * * * *

* * * *

* * *

* *

*

Gune loop n ++ atau --... Gune java.. pastu jawapan inverse bg output 2..

Plz... He3x.. Mestileh wat kan...

Edited by inStar

Share this post


Link to post
Share on other sites

ni nm nyer assignment

kalo ko xblaja bt sndri....

ssh la ko nk blaja nnt

p/s: buat topic yg descriptive (bgtau mslh secara ringkas)

contoh

- masalah jvm

- error xxxxxxxxx

- xleh compile

etc...

Share this post


Link to post
Share on other sites

memang r asas kalu dah x leh wat camne... yg aku bg tu dah dapat... tapi aku nak tau coding yang inverse die... aku dah tanya semue budak terer kat fac. aku... tapi dah x leh cam ne... kalu ko pandai tolong adjust coding ni....

public class TEST{

public static void main(String[] args){

int i = 0;

do{

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

for (int k=3; k >= i; k--){

System.out.print(" ");}

System.out.print("*");

}

System.out.println();

i++;

}while (i <=4);

}

}

tolong susun kan.... huhuhu....

Share this post


Link to post
Share on other sites

aku bg hint skit

4 = 5 - 1
3 = 5 - 2
2 = 5 - 3
1 = 5 - 4

ni exercise utk korg la, bncg rmi2 :lol:

p/s: mcm soklan aku sem 1 dl je kekekeke

ko bdk mn?

Share this post


Link to post
Share on other sites

memang r asas kalu dah x leh wat camne... yg aku bg tu dah dapat... tapi aku nak tau coding yang inverse die... aku dah tanya semue budak terer kat fac. aku... tapi dah x leh cam ne... kalu ko pandai tolong adjust coding ni....

public class TEST{

public static void main(String[] args){

int i = 0;

do{

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

for (int k=3; k >= i; k--){

System.out.print(" ");}

System.out.print("*");

}

System.out.println();

i++;

}while (i <=4);

}

}

tolong susun kan.... huhuhu....

susah2 print jer baris per baris, kalo xnak kener buat algorithmnyer. otai math bleh lar.

Share this post


Link to post
Share on other sites

haha...mcm soalan asigment aku dulu...

aku x nak kasi tau kat sini..nanti ko lagi x pandai..baik pikir idea dan buat algoritma sendiri..

kalau x leh buat aku tak tau la..buat malu kat budak matrikulasi je... diorg pun leh buat..

Share this post


Link to post
Share on other sites

memang r asas kalu dah x leh wat camne... yg aku bg tu dah dapat... tapi aku nak tau coding yang inverse die... aku dah tanya semue budak terer kat fac. aku... tapi dah x leh cam ne... kalu ko pandai tolong adjust coding ni....

public class TEST{

public static void main(String[] args){

int i = 0;

do{

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

for (int k=3; k >= i; k--){

System.out.print(" ");}

System.out.print("*");

}

System.out.println();

i++;

}while (i <=4);

}

}

tolong susun kan.... huhuhu....

Dah dapat buat ke belum ni....

Share this post


Link to post
Share on other sites

public class TEST{

public static void main(String[] args){

int i = 0;

do{

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

for (int k=3; k >= i; k--){

System.out.print(" ");}

System.out.print("*");

}

System.out.println();

i++;

}while (i <=4);

}

}

kenapa nak guna 3 variables? 2 je senang.... Kalau aku, aku buat camnie:

public static void main(String args[]) {
    int a;
        
    for (a = 0; a <= 4; a++) {
        for (int b = 0; b <= a; b++)
            System.out.print("* ");
        System.out.println();
    }
        
    System.out.println("\n");
        
    while (a >= 0) {
        for (int b = 0; b <= (a - 1); b++)
            System.out.print("* ");
        System.out.println();
        a--;
    }
}

B)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...