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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Given a number N in decimal base, find number of its digits in any base (base b)
- Check if a number N starts with 1 in b-base
- Check if a number N can be expressed in base B
- Check whether a number has consecutive 0's in the given base or not
- 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
- Check if N contains all digits as K in base B
- C++ program to find all numbers less than n, which are palindromic in base 10 and base 2.
- Add two integers of different base and represent sum in smaller base of the two
- Complement of a number with any base b
- Pandigital number in a given base
- Largest value of x such that axx is N-digit number of base b
- Number System and Base Conversions
- Largest N digit number in Base B
- Find most significant bit of a number X in base Y
- Number of trailing zeroes in base B representation of N!
- Ternary number system or Base 3 numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.