A logic gate is simply an electronic circuit which operates on one or more input singles and produces a output.

## TYPES OF LOGIC GATES

There are eight types of logic gates which can generate different outputs for the inputs. They can have any number of inputs lines but they have always a single output line. These eight logic gates as:

- AND gate
- OR gate
- NOT gate or invert gate
- NAND gate
- NOR gate
- Buffer gate
- XOR gate or exclusive-OR gate
- XNOR gate or exclusive-NOR gate

### ALGORITHM FOR AND GATE

An AND gate does the logical multiplication operation. An AND gate generates High output if all the inputs are at High state simultaneously. If any one of the input is at Low state then output is also Low. Let 1 represents High state and 0 represents Low state. Then the algorithm for And gate is as follows.

Step 1: Start

Step 2: Read: Take input values [ Only 0 and 1 can be taken as Input values ]

Step 3: [ Checking ] If All the Inputs are 1 then:

Print: The output is also 1.

Else

Print: The output is 0.

[ End of If Else Structure ]

Step 4: Exit

#### FLOWCHART FOR AND GATE

### ALGORITHM FOR OR GATE

An OR Gate does the logical addition operation. An OR Gate gives high output if at least one of the inputs is high. And it gives low output if all the inputs are low. If 1 represents high output and 0 represents low output then the algorithm for OR Gate is as written.

Step 1: Start

Step 2: Read: Take inputs for OR Gate [ Input values can be either 1 or 0 ]

Step 3: [ Checking ] If All the Inputs are 0 Then:

Print: Output is also 0.

Else

Print: Output is 1.

[ End of If structure ]

Step 4: Exit

#### FLOWCHART FOR OR GATE

### ALGORITHM FOR NOT GATE

A NOT Gate does the complement operation. Thus if the input is high then the output will be low and if input is low then output is high. Let 1 represents high value and 0 represents low value. Then algorithm for NOT Gate operation is as follows.

Step 1: Start

Step 2: Read: Take a single Input either 1 or 0

Step 3: [ Checking ] If Input is 1 Then:

Print: Output is 0.

Else

Print: Output is 1.

[End of If Else Structure ]

Step 4: Exit