Program an exclusive OR operation with logical operators - MATLAB Cody - MATLAB Central

Problem 195. Program an exclusive OR operation with logical operators

Difficulty:Rate

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

Solution Stats

56.48% Correct | 43.52% Incorrect
Last Solution submitted on Aug 14, 2025

Problem Comments

Solution Comments

Show comments
MATLAB EXPO 2025 Registration is Now Open! November 12 – 13, 2025
Registration is now open for MathWorks annual virtual event MATLAB EXPO 2025...
0
0

Problem Recent Solvers733

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!