Problem H
Truth Table
Problem Statement
Logic gate is
one of the important component in digital system. There are different types of
gates. One of the interesting things is
that whatever the type of the gate is the input combination will be the same.
The output combination differs from gate to gate. For example let us consider
the following gates
OR Gate
|
|
AND Gate
|
|
NAND Gate
|
|||||||||
A
|
B
|
C
|
X
|
|
A
|
B
|
C
|
X
|
|
A
|
B
|
C
|
X
|
0
|
0
|
0
|
0
|
|
0
|
0
|
0
|
0
|
|
0
|
0
|
0
|
1
|
0
|
0
|
1
|
1
|
|
0
|
0
|
1
|
0
|
|
0
|
0
|
1
|
1
|
0
|
1
|
0
|
1
|
|
0
|
1
|
0
|
0
|
|
0
|
1
|
0
|
1
|
0
|
1
|
1
|
1
|
|
0
|
1
|
1
|
0
|
|
0
|
1
|
1
|
1
|
1
|
0
|
0
|
1
|
|
1
|
0
|
0
|
0
|
|
1
|
0
|
0
|
1
|
1
|
0
|
1
|
1
|
|
1
|
0
|
1
|
0
|
|
1
|
0
|
1
|
1
|
1
|
1
|
0
|
1
|
|
1
|
1
|
0
|
0
|
|
1
|
1
|
0
|
1
|
1
|
1
|
1
|
1
|
|
1
|
1
|
1
|
1
|
|
1
|
1
|
1
|
0
|
On the above
example the input combination (A, B, C) are the same. The output combinations
differs (here X is the output).
As a programmer
write a program that will take number of inout variables as input and show their
input combinations as output.
Input:
The program takes
one line input. The input is N
(1<=N<=3) that means total number of input for a particular Gate.
Output
The program
contains many test cases. In every case it shows input combinations as output.
Sample input
|
Sample output
|
2
3
|
00
01
10
11
000
001
010
011
100
101
110
111
|
Solve this with 1<=N<=31
ReplyDelete