XOR And XNOR Logic Gate - DYclassroom | Have Fun Learning :-)
HomeCoding RoundWebCodeDatabaseAppContentGame DarkBasic Logic Gates AND OR NOTNAND and NOR logic gateXOR and XNOR logic gateUniversal Logic Gate NANDUniversal Logic Gate NORMenuXOR and XNOR logic gateLogic Gate
Share ← PrevNext →In this tutorial we will learn about XOR and XNOR logic gates.
Logic Gate: XOR
The logic gate XOR (Exclusive OR gate) takes two or more input and works as per the following truth table.


i.e., if there are even number of 1 or TRUE as input then the output is 1 or TRUE else it is 0 or FALSE.
Where, 0 means OFF or FALSE and 1 means ON or TRUE.
XOR in code
We use the caret character ^ for XOR in programming language like C, C++, Java, JavaScript, Php etc.
So, if we are given an if-statement then the code inside the if block will be executed if both the variables (expression) are different i.e, TRUE-FALSE.
//javascript var A = true; var B = false; if(A ^ B) { console.log("Hello"); } else { console.log("Bye"); }The given code will print Hello as both A and B are different.i.e., A ^ B= true ^ false= true
Logic Gate: XNOR
The logic gate XNOR (Exclusive NOR gate) is reverse of the XOR gate and takes two or more input and works as per the following truth table.


i.e., if there are even number of 1 or TRUE as input then the output is 1 or TRUE else it is 0 or FALSE.
XNOR in code
We use the caret character ^ and ! for XNOR in programming language like C, C++, Java, JavaScript, Php etc.
So, if we are given an if-statement then the code inside the if block will be executed if both the variables (expression) are same i.e., TRUE-TRUE or FALSE-FALSE.
//javascript var A = true; var B = true; if(!(A ^ B)) { console.log("Hello"); } else { console.log("Bye"); }the given code will print Hello as both A and B are same.i.e., A ^ B= true ^ true= falseand !false = true
← PrevNext →ShareADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
- HOME
- ABOUT
- PRIVACY
- TERMS
- CONTACT
- BUG
- CONTENT
- APP
© 2014 - 2025 dyclassroom. All rights reserved.
Từ khóa » Xor Và Xnor
-
XOR And XNOR - Digilent Reference
-
Bài 3: Các Cổng Logic : AND, OR, NAND, XOR, NOT - IzTuts
-
Cổng Logic – Wikipedia Tiếng Việt
-
Cổng XOR Là Gì - Mobitool
-
Cổng Xor Là Gì Và Xor - Ứng Dụng Của Phép Toán Xor
-
XOR And XNOR Gate As Inverter - YouTube
-
How Logic Gates Work: OR, AND, XOR, NOR, NAND, XNOR, And NOT
-
[PDF] Bài 12: CỔNG LOGIC
-
Point Operations - Logical XOR/XNOR
-
And, Or, Nand, Xor, Not, Giới Thiệu Các Cổng Logic
-
[PDF] CMOS Logic Gates Review: XOR/XNOR And TGs
-
Nguyên Lý Hoạt động Của Các Cửa Logic:OR, AND, XOR, NAND ...