Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Can't find the out put

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can't find the out put

    d. (user enters "hello" and 4)

    System.out.println("Enter a name.");
    String name = keysIn.next();
    keysIn.nextLine();
    System.out.println("Enter a number.");
    int num = keysIn.nextInt();

    if (num % 2 == 0) {
    int counter = 0;
    while (counter <= num) {
    System.out.println(counter + " " + name);
    counter += 2;
    }
    } else {
    int counter = num;
    do {
    System.out.println(name);
    counter--;
    } while (counter >= 1);
    }


  2. #2
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: Can't find the out put

    Hi Javab4,

    Please read the forum announcements which tell you how to ask a question, and demonstrate how to post code snippets ( using code tags ). Then please edit your post to reflect your reading.

    Currently you haven't actually asked a question, only made a statement.

Similar Threads

  1. How to put my code onto the window.
    By Shzylo in forum Java Theory & Questions
    Replies: 1
    Last Post: December 18th, 2012, 09:34 PM
  2. How to put a timer?!?
    By mrprogrammer in forum What's Wrong With My Code?
    Replies: 7
    Last Post: August 21st, 2012, 10:44 AM
  3. [SOLVED] how to put changeable value in JTextField?
    By scorpas in forum Java Applets
    Replies: 34
    Last Post: May 21st, 2012, 05:24 PM
  4. Having trouble returning the right out put.
    By byako in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 26th, 2011, 11:49 PM
  5. how can i print the out put !
    By Faha in forum Java IDEs
    Replies: 5
    Last Post: December 30th, 2010, 04:41 AM