# Thread: How do i write a program that does this?

1. ## How do i write a program that does this?

hi. i have this program i came across but i do not know how to do it. can someone help?

Program:

Consider an n-bit binary number in the following form:
bn−1bn−2bn−3...b0
Each bi is a single bit in the n-bit binary number. Each bi has one of two possible values: 0 or 1. An example of a 6-bit binary number is: 110011. Inside the computer, integers are represented as binary numbers. For example, the integer 43 can be represented by the 6-bit binary number: 101011. In this part, we will make use of an m-bit binary pattern that is constructed by taking the first m-bits of the repeating sequence 101010. For example, for m equal to 3, the binary pattern is: 101. For m equal to 6, the binary pattern is: 101010. For m equal to 1, the binary pattern is: 1.
Write a C program that reads integers n and m as input, and then prints out all n-bit binary numbers that contain the m-bit pattern. The binary numbers must be printed in ascending order. You are not allow to use strings, arrays or recursion for this question. Your program may assume that n will be a natural number less than or equal to 30, and that m will be a natural number less than or equal to n.

2. Rondel, check out our homework policy, please.

Basically, you need to show work on this assignment, and ask specific questions or post specific problems you're having.