How to do numerical inputs

I have a part in the game I’m writing where the player is required to enter a specific number. How would I write a rule for this?

That depends on which language you’re using; are you writing in I7, I6, TADS, Adrift, Hugo…? There are subforums for the appropriate languages.