#include<stdio.h>
int main()
{
	double Numbers[15]={0};
	int Counts[15]={0};
	//tarife pointer
	double *a, *MaxRepeatedNumber;
	int *i, *j, *EmptyCellIndex, *CountOfRepeat;
	//gereftane fazaye hafeze baraye pointer ha
	a = (double*)malloc(sizeof(double));
	MaxRepeatedNumber = (double*)malloc(sizeof(double));
	i = (int*)malloc(sizeof(int));
	j = (int*)malloc(sizeof(int));
	EmptyCellIndex = (int*)malloc(sizeof(int));
	CountOfRepeat = (int*)malloc(sizeof(int));

	//pardazesh barname
	*EmptyCellIndex = 0;
	*CountOfRepeat = 0;
	printf ("tedade 15 adad vared konid : ");
	for(*i=0; *i < 15; (*i)++)
	{
		//daryaft vorodi
		scanf("%lf", a);
		//ezafe kardan tedad dar araye Counts agar vorodi tekrar dasht
		for(*j=0; *j < *EmptyCellIndex; (*j)++)
			if(Numbers[*j] == *a)
			{
				Counts[*j]++;
				break;
			}
		//ezafe kardan tedad dar araye Counts baraye vorodi jadid va Zakhire dar araye Numbers
		if(*j == *EmptyCellIndex)
		{
			Numbers[*EmptyCellIndex] = *a;
			Counts[*EmptyCellIndex]++; 
			(*EmptyCellIndex)++;
		}
	}
	//peida kardan adad bishtarin tekrar
	for(*i=0; *i < 15; (*i)++)
		if(Counts[*i] > *CountOfRepeat)
		{
			*CountOfRepeat = Counts[*i];
			*MaxRepeatedNumber = Numbers[*i];
		}
	printf("Natije = %g, Tedade Tekrar = %d\n", *MaxRepeatedNumber, *CountOfRepeat);

	//azad sazi fazaye hafeze baraye pointer ha
	free(a);
	free(MaxRepeatedNumber);
	free(i);
	free(j);
	free(EmptyCellIndex);
	free(CountOfRepeat);

	getch();
}

