Problem 195. Program an exclusive OR operation with logical operators

Created by Tobias Otto

Program an exclusive or operation without using the MATLAB function xor.

Use logical operators like |, &, ~, ... instead.

Examples:

myXOR(1,1)
ans = 0
myXOR(1,0)
ans = 1
myXOR(0,1)
ans = 1
myXOR(0,0)
ans = 0

Tags

Problem Group

189 solvers submitted 369 solutions (1.95 solutions/solver).

Problem Comments

Solution Comments