I am trying to find the maximum number using a loop and count the number to times the max was entered. I am having trouble with finding and checking for the maximum and counting the number of times it has been entered. Can someone please give me some advice.
Code:
#include <stdio.h>
int main()
{
int max;
int i;
int current;
int numbers;
int count = 0;
printf("\nHow many numbers?: ");
scanf("%d", &numbers);
for (i = 0; i < numbers; i++)
{
scanf("%d", current);
if (max > current)
{
max = current;
count++;
}
}
printf("Max: %d Number of times: %d\n", max, count);
system("PAUSE");
return 0;
}