Problem 44814. Find the complement of a number in binary

Created by Rafi Ahmed in Community

Input x is a decimal number and output y is the complement of binary representation of x.

For example, x = 10 has the binary representation of 00001010 (Assume, 8-bit binary representation).

[0   0   0   0   1   0   1   0]

And the output is

y = [1   1   1   1   0   1   0   1]

Solution Stats

42.42% Correct | 57.58% Incorrect
Last solution submitted on Mar 04, 2019

Recent Solvers13

Suggested Problems

More from this Author1

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!