Hello, need help please.
Can't get it right, Not working a count of how much maximum number was typed. what's wrong ? Thank you.
Code:
#include <stdio.h>
#define n 5
int main()
{
int i, num[n], max, qty = 1, ch;
for (i = 0; i < n; i++)
{
printf("Please enter num %i\n", i);
scanf("%i",&num[i]);
}
max = num[0];
for (i = 0; i < n; i++)
{
if (num[i] > max)
{
max = num[i];
}
if (num[i] == max) // Need to calculate how many times the maximum number is.
{
qty++;
}
}
printf("The highes number %i was times %d \n", max, qty); // need to print the max number and qty of maximum number.
}