Every scanf and flush call will require something in the input buffer from you. For each piece of input you want, call scanf exactly once and flush exactly once immediately after it. Also, scanf with "%d" will only get the whole number portion of a float. You can't stop it printing the characters you type in, but the "%d" will stop it from gathering non-integer stuff (like a decimal point) and putting them in num. The will get eaten by your flush call.
Your number gathering is a bit off:
- Only call scanf once, assigning the result of count to it
- Flush the input buffer immediate when you're done.
- Check all error conditions in one do-while loopAlso, you have a few hiccups in your "more" loop:Code:do count = scanf flush if count != 1 print error else if not odd print error while count != 1 || (num % 2) == 0
- Flush the input buffer right after you get a character from scanf.
- You want single quotes for an individual character, "Y" is a string, totally different
- (more == 'y' || 'Y') isn't what you think, you want (more == 'y' || more == 'Y')