Results 1 to 7 of 7

Thread: triangle

  1. #1
    dinn is offline Member
    Join Date
    Dec 2011
    Posts
    4
    Rep Power
    0

    Default triangle

    i'll make a triangle using this code,ad get the output like that..


    class Cuba9{

    public static void main(String[]args){

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

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

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

    *
    **
    ***
    ****

    now i want to make it like a mirrow reflect ,so what should i do,can i just do it using the same coding or need to change it. I'm a noob,just learn it yesterday,this is my exercise,someone help me..
    Last edited by dinn; 12-07-2011 at 05:02 PM.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: triangle

    What is the difference between the first triangle and the second one?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    dinn is offline Member
    Join Date
    Dec 2011
    Posts
    4
    Rep Power
    0

    Default Re: triangle

    the second triangle should look like this

    ......*
    ....**
    ..***
    ****
    Last edited by dinn; 12-07-2011 at 05:10 PM.

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: triangle

    Quote Originally Posted by dinn View Post
    the second triangle should look like this

    *
    **
    ***
    ****
    Umm. I think you probably want to use the code tags to preserve formatting.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    dinn is offline Member
    Join Date
    Dec 2011
    Posts
    4
    Rep Power
    0

    Default Re: triangle

    sorry,i'm new to this forum,so don't know what to do..huu

  6. #6
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: triangle

    Well then, as for your original question- you're going to have to use different code, but the same types of principles will apply. Write out exactly what you want to happen before you even sit down to a computer.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    dinn is offline Member
    Join Date
    Dec 2011
    Posts
    4
    Rep Power
    0

    Default Re: triangle

    ok sorry again,don't make a same mistake next time,hehe

Similar Threads

  1. triangle
    By Shyamz1 in forum New To Java
    Replies: 4
    Last Post: 11-07-2010, 06:12 PM
  2. Inverted Right Triangle help
    By aspire007 in forum New To Java
    Replies: 6
    Last Post: 07-30-2010, 06:10 PM
  3. Triangle using Numbers
    By Anandt88 in forum New To Java
    Replies: 16
    Last Post: 06-05-2010, 04:10 PM
  4. triangle program
    By computerbum in forum New To Java
    Replies: 8
    Last Post: 03-02-2010, 04:55 AM
  5. Triangle
    By jkswebsite in forum New To Java
    Replies: 8
    Last Post: 01-10-2009, 02:08 PM

Posting Permissions

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