Skip to main content

Generate all initial n numbers formed from 0 1 and 2

Given an size N, our goal is to print all positive number is consist 0,1 and 2s.

Example 
Input : 50

Output :
0 1  2  10  11  12  20  21  22  100  101  102  110  
111  112  120  121  122  200  201  202  210  211  212
220  221  222  1000  1001  1002  1010  1011  1012 
1020  1021  1022  1100  1101  1102  1110  1111  
1112  1120  1121  1122  1200  1201  1202  1210  1211

Here given code implementation process.





Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment