Home » ALGORITHM » ALGORITHM FOR BASIC GATES

# ALGORITHM FOR BASIC GATES

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:

1. AND gate
2. OR gate
3. NOT gate or invert gate
4. NAND gate
5. NOR gate
6. Buffer gate
7. XOR gate or exclusive-OR gate
8. 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

### 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

### 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

### Related Posts

• NOT GATE This Gate circuit provides an output only when the input signal to the Gate is not present. A NOT gate is the physical realisation of the complementation operation. Recall that the […] Posted in LOGIC GATES
• OR GATE An OR gate is the physical realization of the logical addition (OR) operation. That is, it is an electrical circuit that generates an output signal of 1 only if any of the input signals is […] Posted in LOGIC GATES
• ALGORITHM TO GENERATE FIBONACCI SERIES Fibonacci Series is a sequence of Integer numbers. The first 20 numbers of Fibonacci Series is shown here. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, […] Posted in ALGORITHM
• ARMSTRONG NUMBER ALGORITHM AND FLOWCHART An Armstrong Number is a Number whose sum of cubes of its digits is equal to itself. The smallest Armstrong Number is a three digit number and it is 153. Other Armstrong Numbers are 370, […] Posted in ALGORITHM