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: Program that reads integers, finds the smallest of them, and counts its occurrences

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    17
    My Mood
    Daring
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Program that reads integers, finds the smallest of them, and counts its occurrences

    i need help with this homework, i tried to do it many times but still the outputs are wrong,
    help is appreciated.

    Write a program that reads integers, finds the smallest of them, and counts
    its occurrences. Assume that the input ends with number 0. Suppose that
    you entered 30 50 20 50 20 50 100 0; the program finds that the smallest is
    20 and the occurrence count for 20 is 2.
    If the occurrences of the smallest number is greater than 1, print the value
    of the number and the number of occurrences. However, if the smallest
    number occurrences is equal 1, print only the value of the smallest number.
    Note: the occurrences of a number means how many times this number has
    been entered in the input.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Program that reads integers, finds the smallest of them, and counts its occurrenc

    i tried to do it many times but still the outputs are wrong
    We have not clue what you tried, so cannot provide specific guidance. Ask a specific question and your chances of help increase substantially

Similar Threads

  1. Replies: 1
    Last Post: November 6th, 2011, 09:48 PM
  2. A program that counts the number of punctuation marks in a text file
    By Twoacross in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 21st, 2011, 04:03 PM
  3. Output Largest and Smallest Integers using only If statements
    By jcattau in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 2nd, 2011, 05:55 PM
  4. [SOLVED] My smallest and largest integers will not change.
    By toiletsauce in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 1st, 2011, 07:50 PM
  5. Determine the two smallest integers from a set of user input integers
    By bpontin in forum Loops & Control Statements
    Replies: 4
    Last Post: October 17th, 2010, 06:38 PM