Assuming n is a decimal number.
Divide n by 2 repeatedly, and summing the remainders will give the number of one's in binary representation.
pseudocode of algorithm:
Enter value of n:
sum=0;
while n>0 {
sum=mod(n,2);
n=n/2 [integer division]
}
Display n, sum
Answer:
-3
Step-by-step explanation:
1. Choose two coordinates on the line and count up and over to get the slope. For example, let's use coordinates (0,4) and (1,1).
Remember, slope is equal to rise/run. However, since the line is drawn in a downward diagonal direction, the slope is negative.
Start from (1,1) and count up and then left until you get to (0,4).
Count up 3 and left 1
Rise/run = -3/1.
2. Reduce it down to 3.
Slope is -3
Answer:
.
Step-by-step explanation:
How many unique combinations are possible in total?
This question takes 5 objects randomly out of a bag of 50 objects. The order in which these objects come out doesn't matter. Therefore, the number of unique choices possible will the sames as the combination
.
How many out of that 2,118,760 combinations will satisfy the request?
Number of ways to choose 2 red candies out a batch of 28:
.
Number of ways to choose 3 green candies out of a batch of 8:
.
However, choosing two red candies out of a batch of 28 red candies does not influence the number of ways of choosing three green candies out of a batch of 8 green candies. The number of ways of choosing 2 red candies and 3 green candies will be the product of the two numbers of ways of choosing
.
The probability that the 5 candies chosen out of the 50 contain 2 red and 3 green will be:
.
Rate times time equal distance
75*t=30
Divide both sides by 75.
40 minutes