A
A
Alex2017-10-30 11:22:42
Programming
Alex, 2017-10-30 11:22:42

Searching 0 and 1 in si?

It is necessary to go through all possible combinations of 0 and 1, for example, we enter the number 2, the output is
0 0,
0 1,
1 0,
1 1
, and so on for any number

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2017-10-30
@sen4ek

Normal loop, from zero to 2 to the power of the specified number (not including the upper bound), in increments of one. The desired combinations of zeros and ones are binary representations of the cycle counter.

C
cicatrix, 2017-10-30
@cicatrix

We enter n
Run the loop i from 0 to 2 n - 1
In the loop, each i is output in binary representation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question