Given a number as string and a base, check if given number is in given base or not.
Input : str = "1010", base = 2 Output : Yes Input : str = "1015", base = 2 Output : No Input : str = "AF87", base = 16 Output : Yes
The idea is to one by one check if all digits are in given base range. If yes, return true, else return false.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Check whether a number has consecutive 0's in the given base or not
- Program to check if a number belongs to a particular base or not
- Check if a number is power of k using base changing method
- Find the Nth digit from right in base B of the given number in Decimal base
- Given a number N in decimal base, find the sum of digits in any base B
- Add two integers of different base and represent sum in smaller base of the two
- Complement of a number with any base b
- Largest N digit number in Base B
- Find most significant bit of a number X in base Y
- Number System and Base Conversions
- Largest value of x such that axx is N-digit number of base b
- Convert a number into negative base representation
- Ternary number system or Base 3 numbers
- Count of primes after converting given binary number in base between L to R
- Find the Largest N digit perfect square number in Base B
- Number of common base strings for two strings
- Check if a large number is divisible by a number which is a power of 2
- Double Base Palindrome
- Check Whether a number is Duck Number or not
- Check if a number ends with another number or not
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.