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 3 of 3

Thread: Java puzzle Help needed

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

    Default Java puzzle Help needed

    Write a Program which takes n non-zero Integer arguments where n>3.
    You need to use n-1 arguments in the same order to have the result as the nth argument by applying any of the arithmetic operators [ + , - , * , / ].
    Assume all the operators will have same precedence.

    Example 1:
    Given n = 5 numbers are
    1 2 3 4 20
    Solution has to be provided in such a way that output should be as below
    1 * 2 + 3 * 4 = 20

    Example 2:
    Given n = 3 numbers are
    10 2 5
    Solution has to be provided in such a way that output should be as below
    10 / 2 = 5


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,256
    My Mood
    Hungover
    Thanks
    142
    Thanked 618 Times in 529 Posts

    Default Re: Java puzzle Help needed

    This thread has been cross posted here:

    http://www.java-forums.org/algorithm-codes/82091-java-puzzle-help-needed.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,261
    Thanks
    176
    Thanked 820 Times in 763 Posts
    Blog Entries
    5

    Default Re: Java puzzle Help needed

    The implied question is: will someone do my homework for me. And the implied answer is NO. If you actually wish to learn, then make an attempt and ask a specific question in a new thread should you get stuck along the way, because I am locking this thread.

    This thread has been cross posted here:

    http://www.coderanch.com/t/620682/java/java/Java-puzzle

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


Similar Threads

  1. 15 square puzzle
    By Yamaha360 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: April 10th, 2013, 02:10 PM
  2. Grails Developer Needed - URGENTLY NEEDED *WORK FROM HOME*
    By IngeniumR in forum Paid Java Projects
    Replies: 0
    Last Post: February 5th, 2013, 06:19 AM
  3. Puzzle Game. Need some help
    By clydefrog in forum Java Theory & Questions
    Replies: 10
    Last Post: March 12th, 2012, 03:14 PM
  4. help needed with java...
    By amzz in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: April 12th, 2011, 03:33 AM
  5. Java sliding block puzzle issues
    By Vesper in forum What's Wrong With My Code?
    Replies: 15
    Last Post: April 11th, 2011, 07:30 AM