Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
how to validate range of hex,binary,octal or decimal numbers?
I am needing to validate the numbers entered by the user. The user enters number in either of the four formats namely hex,binary,octal or decimal. I need to validate the numbers such that if the user enters a hex number other than 0 to 7FFFFFFF my if statement should be able to validate that and prompt the user again to enter the number in range. In the same way if a binary number is entered other than
0 to 1111111111111111111111111111111(31 1's) or an octal number other than 0 to 17777777777, again my if statement or any other mechanism should be able to validate and output a warning message about out of range number and prompt the user to enter that number in question again. I just can't start thinking in some direction...please help.
Thanks in advance.
0 · ·