Answer:
var findComplement = function(num) {
var start = false;
for (var i = 31; i >= 0; --i) {
if (num & (1 << i)) {//find the leftmost hightest bit 1 and start from there
start = true;
}
if (start) {
num ^= (1 << i);
}
}
return num;
};
var findComplement = function(num) {
var bits = num.toString(2);
var complement = '';
for(var i=0;i<bits.length;i++)
{
complement += (bits[i]==1?0:1);
}
return parseInt(complement,2);
};
Explanation:
The javascript code above would accept a number in the variable complemnt and using the parseint keyword, it converts it to a binary value of that number.
Each bit is converted from the least to the most significant bit, then it is returned to the find compliment function and converted back to an integer.
Answer:
A business' ability to communicate with its employees, customers and associates changed dramatically when the Internet yielded new communication tools. Email and instant messaging have changed the face of business communication.
Answer:
thumbnail pane
Explanation:
just took the review for it
Answer:
The program in Python is as follows:
num = int(input())
for i in str(num):
print(int(i))
Explanation:
This gets input for the number
num = int(input())
This converts the number to string and iterates through each element of the string
for i in str(num):
This prints individual digits
print(int(i))