What's wrong with this code?

This is supposed to be a program which finds the most frequently typed in number
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  #include <stdio.h>
int main(void)
{
	int stats[20], i, j;
	int mode, count, oldcount, oldmode;
	printf("Enter 20 numbers: \n");
	for (i = 0; i < 20; i++)
		scanf_s("%d", &stats[i]);
	oldcount = 0;
	/*откриване на режима*/
	for (i = 0; i < 20; i++)
	{
		mode = stats[i];
		count = 1;
		/*преброяване на появяванията на тази стойност*/
		for (j = i + 1; j < 20; j++)
			if (mode == stats[j])
				count++;
		/*ако count е по-голямо от oldcount, използване на нов режим*/
		if (count > oldcount)
		{
			oldmode = mode;
			oldcount = count;
		}
	}
	printf("The mode is %d\n", oldmode);
	return 0;
}
And what happened? Can you elaborate on " finds the most frequently typed in number" a bit more?
I assume that you are looking for the mode based on a file with multiple number, maybe?

Just as SakurasouBusters said we can't help you unless more information is given.

~Hirokachi
So what's the problem ?
So basically this program should be able to find the most typed in number after entering 20 numbers... i can run it and enter 20 numbers but further it does nothing... it does not output the result (The mode is %d).
> it does not output the result
yes, it does.
perhaps you didn't input 20 numbers or you forgot to press <Return>
Topic archived. No new replies allowed.