this program prints out the number of times the motif "1101" occurs in the binary representation of the entered number. For instance, the number "1101101001101" would contain the motif 3 times. Note that the occurrences of the motif can overlap. Motif recognition and identification is a very important problem in many areas (computer vision, bioinformatics, automated learning, searching), and this is a very, very simple example of it.

Here is an example interaction with the program:

% ./hw6_ex2

Enter an integer: 4321

The binary representation is: 00000000000000000001000011100001

The number of '1101' motifs is: 0

% ./hw6_ex2

Enter an integer: 123041231

The binary representation is: 00000111010101010111010111001111

The number of '1101' motifs is: 2

% ./hw6_ex2

Enter an integer: 14540253

The binary representation is: 00000000110111011101110111011101

The number of '1101' motifs is: 6

Again, you can assume that the user always enters a valid integer.

Here is an example interaction with the program:

% ./hw6_ex2

Enter an integer: 4321

The binary representation is: 00000000000000000001000011100001

The number of '1101' motifs is: 0

% ./hw6_ex2

Enter an integer: 123041231

The binary representation is: 00000111010101010111010111001111

The number of '1101' motifs is: 2

% ./hw6_ex2

Enter an integer: 14540253

The binary representation is: 00000000110111011101110111011101

The number of '1101' motifs is: 6

Again, you can assume that the user always enters a valid integer.

#### Top Answer

Hello, We can only answer your free 3 questions per day one at a time. Please re-submit an individual question here:... View the full answer