Question: Create a C program that asks the user to enter pairs of positive integers (separated by a space), and a negative (non-zero) integer to stop.
Create a C program that asks the user to enter pairs of positive integers (separated by a space), and a negative (non-zero) integer to stop. For each pair of integers, it will print the Hamming distance between the bit representations of those two integers. For example, if the user inputs 0 1, then the Hamming distance is equal to 1. The Hamming distance between two strings is the number of positions in which they differ. The bit representation of 0 is ....0000 and the bit representation of 1 is ....0001 (where dots represent all zero). So the Hamming distance between them is 1. The Hamming distance between 0 and 3 would be 2. The Hamming distance between 1 and 3 would be 1.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
