Given a number n, write a program that generates and prints all binary numbers with decimal values from 1 to n.
Answers
Answered by
3
Explanation:
Given a positive number N, efficiently generate binary numbers between 1 to N using queue data structure and in linear time. For example, for N = 10, the binary numbers are. 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111 10000.
Answered by
3
computer can understand only binary format
hope it helps you
Attachments:
Similar questions