Problem 44814. Find the complement of a number in binary
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
Problem Comments
-
1 Comment
Rafael S.T. Vieira
on 12 Aug 2020
Your problem needs to define the complement of a binary number. There is more than one way to do it with negative numbers.
Solution Comments
Show commentsProblem Recent Solvers45
Suggested Problems
-
How to find the position of an element in a vector without using the find function
2768 Solvers
-
Sum of diagonal of a square matrix
1603 Solvers
-
Calculate the area of a triangle between three points
3248 Solvers
-
Matrix with different incremental runs
541 Solvers
-
343 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!