Chat with our AI personalities
Read more: C_program_to_find_the_given_number_is_Adam_number
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
The greatest number is infinity.
Yes
Assuming the number is represented by a decimal integer, initialise a counter to zero, then repeatedly divide the number by 10 and until the number is zero. After each division, examine the remainder. Each time the remainder is zero, increment the counter. If the number is represented by a decimal float, repeatedly multiply by 10 until the value is an integer, then perform the previous algorithm.
1. Find algorithm.2. Implement it.Hint: if a non-zero N number has K 1-bits, then (N AND N-1) has K-1 1-bits.