Results 1 to 13 of 13
Like Tree7Likes
  • 4 Post By JosAH
  • 2 Post By JosAH
  • 1 Post By JosAH

Thread: give me a code

  1. #1
    florida is offline Member
    Join Date
    Mar 2013
    Posts
    13
    Rep Power
    0

    Question give me a code

    give me the program for printing below output

    1
    0 1
    1 0 1
    0 1 0 1
    1 0 1 0 1


    help me........ i couldn't find out the logic ....
    thank u in advance

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: give me a code

    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: give me a code

    Quote Originally Posted by florida View Post
    give me the program for printing below output

    1
    0 1
    1 0 1
    0 1 0 1
    1 0 1 0 1
    Duh ...

    Java Code:
    System.out.println("1");
    System.out.println("0 1");
    System.out.println("1 0 1");
    System.out.println("0 1 0 1");
    System.out.println("1 0 1 0 1");
    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    florida is offline Member
    Join Date
    Mar 2013
    Posts
    13
    Rep Power
    0

    Default Re: give me a code

    sorry ............ i just asked .........i never repeat this

  5. #5
    Jamil37037 is offline Member
    Join Date
    Feb 2013
    Location
    Islamabad, Pakistan
    Posts
    25
    Rep Power
    0

    Default Re: give me a code

    Quote Originally Posted by JosAH View Post
    Duh ...

    Java Code:
    System.out.println("1");
    System.out.println("0 1");
    System.out.println("1 0 1");
    System.out.println("0 1 0 1");
    System.out.println("1 0 1 0 1");
    kind regards,

    Jos

    This one is great.

    try to solve it by yourself and use nested loop.

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: give me a code

    Quote Originally Posted by Jamil37037 View Post
    This one is great.

    try to solve it by yourself and use nested loop.
    Duh, I have a better idea; the following AI produces a program that can solve the problem (without loops! :-P

    Java Code:
    System.out.println("System.out.println(\"1\");");
    System.out.println("System.out.println(\"0 1\");");
    System.out.println("System.out.println(\"1 0 1\");");
    System.out.println("System.out.println(\"0 1 0 1\");");
    System.out.println("System.out.println(\"1 0 1 0 1\");");
    kindest regards,

    Jos ;-)
    PhHein and SurfMan like this.
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    florida is offline Member
    Join Date
    Mar 2013
    Posts
    13
    Rep Power
    0

    Default Re: give me a code

    i have done it............ thank u guys.........

  8. #8
    fatabass is offline Senior Member
    Join Date
    Nov 2011
    Location
    Turkey
    Posts
    380
    Blog Entries
    24
    Rep Power
    4

    Default Re: give me a code

    Quote Originally Posted by JosAH View Post
    Duh, I have a better idea; the following AI produces a program that can solve the problem (without loops! :-P

    Java Code:
    System.out.println("System.out.println(\"1\");");
    System.out.println("System.out.println(\"0 1\");");
    System.out.println("System.out.println(\"1 0 1\");");
    System.out.println("System.out.println(\"0 1 0 1\");");
    System.out.println("System.out.println(\"1 0 1 0 1\");");
    kindest regards,

    Jos ;-)
    I do not get this?

  9. #9
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: give me a code

    Quote Originally Posted by fatabass View Post
    I do not get this?
    Another way of doing it, which you might find easier to understand, is:
    Java Code:
    System.out.print("System.out.print(\\\"1\\\"\\n\\\"0 1\\\"\\n\\\"1 0 1\\\"\\n\\\"0 1 0 1\\\"\\n\\\"1 0 1 0 1\\\"\\n\n");
    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  10. #10
    Jamil37037 is offline Member
    Join Date
    Feb 2013
    Location
    Islamabad, Pakistan
    Posts
    25
    Rep Power
    0

    Default Re: give me a code

    Quote Originally Posted by DarrylBurke View Post
    Another way of doing it, which you might find easier to understand, is:
    Java Code:
    System.out.print("System.out.print(\\\"1\\\"\\n\\\"0 1\\\"\\n\\\"1 0 1\\\"\\n\\\"0 1 0 1\\\"\\n\\\"1 0 1 0 1\\\"\\n\n");
    db
    This one is better lolx what you say Jos??? ;-)

  11. #11
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: give me a code

    Quote Originally Posted by DarrylBurke View Post
    Another way of doing it, which you might find easier to understand, is:
    Java Code:
    System.out.print("System.out.print(\\\"1\\\"\\n\\\"0 1\\\"\\n\\\"1 0 1\\\"\\n\\\"0 1 0 1\\\"\\n\\\"1 0 1 0 1\\\"\\n\n");
    db
    I missed a closing paren and semicolon. That should be
    Java Code:
    System.out.print("System.out.print(\\\"1\\\"\\n\\\"0 1\\\"\\n\\\"1 0 1\\\"\\n\\\"0 1 0 1\\\"\\n\\\"1 0 1 0 1\\\"\\n);\n");
    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  12. #12
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: give me a code

    Quote Originally Posted by Jamil37037 View Post
    This one is better lolx what you say Jos??? ;-)
    Obviously created by a silly script kiddie ...

    kind regards,

    Jos ;-)
    DarrylBurke likes this.
    cenosillicaphobia: the fear for an empty beer glass

  13. #13
    Jamil37037 is offline Member
    Join Date
    Feb 2013
    Location
    Islamabad, Pakistan
    Posts
    25
    Rep Power
    0

    Default Re: give me a code

    Quote Originally Posted by JosAH View Post
    Obviously created by a silly script kiddie ...

    kind regards,

    Jos ;-)
    Ok Boss :-)

Similar Threads

  1. Look over my code and give tips?
    By LuluMM in forum New To Java
    Replies: 6
    Last Post: 05-11-2012, 05:49 AM
  2. Replies: 1
    Last Post: 07-28-2011, 09:48 AM
  3. look @ code and give ideas! Install new code....
    By turbowhat in forum New To Java
    Replies: 2
    Last Post: 04-27-2011, 04:08 AM
  4. Plz give me the code of following simple problem..
    By juhiswt in forum New To Java
    Replies: 3
    Last Post: 03-07-2011, 04:54 AM
  5. pleae give me a code
    By Quezza in forum New To Java
    Replies: 3
    Last Post: 01-07-2011, 02:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •