Given a number num in base N, check whether it is even or odd.
Input: num = 10, N = 8 Output: Even Explanation: 108 = 810, which is even Input: num = 122, N = 5 Output: Odd Explanation: 1225 = 3710, which is odd
- Convert the number num from Base N to Decimal base.
- Check whether the number is Odd or Even. This can be easily checked by dividing it with 2, and checking it’s remainder.
Below is the implementation of the above approach.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Given a number N in decimal base, find number of its digits in any base (base b)
- Check whether a number has consecutive 0's in the given base or not
- Check if a number N starts with 1 in b-base
- Check if a given number can be represented in given a no. of digits in any base
- Check if the number is even or odd whose digits and base (radix) is given
- Check if a number is power of k using base changing method
- Given a number N in decimal base, find the sum of digits in any base B
- Find the Nth digit from right in base B of the given number in Decimal base
- C++ program to find all numbers less than n, which are palindromic in base 10 and base 2.
- Complement of a number with any base b
- Pandigital number in a given base
- 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
- Find the length of factorial of a number in any given base
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.