check the divisibility by 13 of a binary number
how to check if a binary number is divisible 13 if the user inputs the
digits from the most significant to the least significant?
the number of bits can be very large,so there is no point converting it
into decimal and then checking its divisibility.
i have approached it in the conventional way. nuber of bits range upto
10^5, so it is giving overflow while converting it into decimal.
how to approach this? example:
110010000100100 it is div by 13
111111111111111 it is not divisible by 13
No comments:
Post a Comment