New guy here and I'm stuck on this code I cant get to work right. I want to input any amount of numbers and I want the output to be the largest number along with how many times the largest number was input. I'm just off a bit but I can't for the life of me figure it out.
ok this is the new and revised version but it STILL messes up the count of the largest number
#include<stdio.h>
#include<stdlib.h>
int main()
{
int num;
int largest= 0;
int count= 0;
while(num>0)
{
printf("Enter a number 0 to end\n");
scanf("%d" ,&num);
if (num >= largest) {
largest = num;
count++;
}
}
printf("The largest number is %d and it was entered %d times\n" ,largest ,count);
system ("pause");
return 0;
}