First of all, you're not initializing your array elements to zero.

int count[10] = {0};

for(i=0;i<10;i++)
{
printf("\n%ioccurs %i times\n",arry[i],count[i]);
}

Ok, you're misunderstanding something about what the indices of 'arry' and 'count' actually

*represent.*arry: sequence of numbers entered. Max

50, according to your declaration: int arry[

50]

count: occurrence of the digits entered in the sequence. Range:

0-9, according to your declaration: int count[

10]

What this means is that you will allow

50 different numbers to be entered by the user. Each one of these must fall within the range of

0-9.

You only prompt for 10 numbers to be entered. Is this what you meant? If so, arry only needs to be

10 units long.

You incorrectly assume there is a direct correlation between the indices of

arry and

count in your code that I referenced above. They aren't actually referring to the same thing.

Here's what 'arry' is referring to:

arry:

Index: **0** --> The **1st** number entered by the user.

Index: **1** --> The **2nd** number entered by the user.

Index: **2** --> The **3rd** number entered by the user.

...

Index: **9** --> The **10th** number entered by the user (the last one according to your code.)Now, here's what 'count' is referring to:

count:

Index: **0** --> The number of times the user typed "**0**" throughout the *whole* sequence.

Index: **1** --> The number of times the user typed "**1**" throughout the *whole* sequence.

Index: **2** --> The number of times the user typed "**2**" throughout the *whole* sequence.

...

Index: **9** --> The number of times the user typed "**9**" throughout the *whole* sequence.When you finally print out the results, you want to know

**how many times the user typed ***X* throughout the *whole* sequence. That means, you'll want to take a look at the values stored in '

count'.

When you loop over the values of 'count' with '

**i**', you are getting the answer to this question: "How many times did the user type

**i** throughout the whole sequence?"

When you loop on '

**i**' from 0 to 9, you get the number of times the user typed 0, the number of times the user typed 1, the number of times the user typed 2, ....... the number of times the user typed 9.

So you see, the values stored in '

arry' are completely irrelevant to figuring out how many times the user typed a number. The only reason we would need to reference 'arry' is if we needed to know

*in which sequence the user typed the numbers.* (In other words, what was the

**first** number the user typed? What was the

**2nd** number the user typed? ... What was the

**last** number the user typed? This is a completely different question from frequency.

Hope that helps.