Like Tree1Likes
  • 1 Post By Salem

Help with counting numbers in arrays

This is a discussion on Help with counting numbers in arrays within the C Programming forums, part of the General Programming Boards category; Can anyone give me any jumping off points on how to make a program where the user inputs N numbers ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    1

    Help with counting numbers in arrays

    Can anyone give me any jumping off points on how to make a program where the user inputs N numbers and they get put into an array and then says how many time each number occurs in the array?


    For example, if the user inputs: - 7 3 3 -7 5 5 3 as the elements of your array. Then the program should print:

    5 occurs 2 times
    3 occurs 3 times
    -7 occurs 2 times

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,848
    Inputting N numbers into an array N of integers would be a good start.
    stahta01 likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Counting Numbers in Array, not counting last number!
    By metaljester in forum C++ Programming
    Replies: 11
    Last Post: 10-18-2006, 12:25 PM
  2. Counting occurrence of numbers in C
    By stabule in forum C Programming
    Replies: 1
    Last Post: 11-13-2005, 01:55 AM
  3. about counting prime numbers
    By cengiz in forum C++ Programming
    Replies: 2
    Last Post: 10-28-2003, 06:07 AM
  4. Counting Page Numbers
    By dayknight in forum C++ Programming
    Replies: 2
    Last Post: 11-11-2002, 06:52 AM
  5. counting even numbers
    By slamit93 in forum C++ Programming
    Replies: 5
    Last Post: 04-24-2002, 02:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21