Results 1 to 3 of 3
  1. #1
    jude113 is offline Member
    Join Date
    Mar 2009
    Posts
    2
    Rep Power
    0

    Default Problem With Looping [JAVA]

    lets say height is = 5

    int height;
    int x,y;

    System.out.print("enter height: ");
    height=SavitchIn.readLineIn();

    for(x=1;x<=height;++x)
    for(y=1;y<=x;++y)

    if (y==x)
    System.out.println("I");

    else
    System.out.print("I");


    this is the output of that thing...

    I
    II
    III
    IIII
    IIIII



    but how about this one...
    u may find it funny but can u make me a java script that will print this thing...
    my teacher told me to make a java script using JCREATOR that will have an output just like this...
    the number of I and dots will be based in the height given..


    ....I
    ...II
    ..III
    .IIII
    IIIII

    badly need it :C

  2. #2
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default Terminology...

    Jude... question... do you want to do the traingle in a Java program or in JavaScript? They are two different things. This is a Java developers forum. If you need to do in Javascript, then you you will have to ask someplace else.

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. problem with <logic:iterate> tag looping
    By tsaswathy in forum Web Frameworks
    Replies: 0
    Last Post: 09-27-2008, 01:13 PM
  2. how to do conditional looping?
    By chennee72 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 09-09-2008, 01:38 PM
  3. Looping problem
    By Tanilo in forum New To Java
    Replies: 1
    Last Post: 08-01-2008, 07:34 AM
  4. Java Looping and decision
    By susan in forum AWT / Swing
    Replies: 1
    Last Post: 08-07-2007, 05:29 AM
  5. looping a function
    By Username in forum New To Java
    Replies: 2
    Last Post: 07-30-2007, 06:37 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
  •