The problem is that when you enter an input that cannot be interpreted as a number, scanf() doesn't process it, but leaves it on the buffer. The next time your loop runs, actually it does not wait for any user input, it looks at the standard input again to see if there's a number there. But the old content is still there so you're going to process that for the rest of eternity and you're in an infinite loop.
You can check how many parameters scanf() has filled up with values. In your case, that's supposed to be 1 (x). If that's not the case, then you couldn't read a number and you should get rid of any leftover input from the standard input. Reading a string and throwing it away (asterisk format modifier "%*s") will do just fine.
Below is your code fixed with the above-suggested change, some variable and user interaction refactoring.
I hope this helps. Good luck! :)
int x, count = 0;
int sum = 0;
printf("Enter the numbers (enter 0 to stop): ");
if (scanf("%d", &x) == 1)
if (x > 0)
sum += x;
while (x != 0);
printf("The sum of positive numbers is %d.\n", sum);
printf("%d positive numbers were entered.\n", count);