applied your changes (ld -> lu, tmp is now long)
still infinite loop when i enter anything BUT numbers

12-08-2010

tabstop

As you've probably noticed, input like "1f" will be accepted just fine by what you have. That's both the good thing and the bad thing about scanf: it will try to match what it can to the input, and as long as something matches, then you'll get a result.

If you want to consider the whole thing they type in, then you'll need to make sure you get all the input. You can either read in the whole line, and then verify the input; or you can read in a character at a time and process as you go.