You want a user to input a number. You want to make sure it's a valid number, and give an error message if it isn't.
Put the user's input into a string variable. Test whether the variable has something that could be interpreted as a valid number. If so, convert the string into a number.
If a user enters text, and you try to store it into a numeric variable, your program may crash. Input the data into a string variable first. An example:
Input goes into a string variable on line 5. Tests on lines 6 and 8 make sure it's numeric. It's converted into a number on line 14.