1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Assoli18 [71]
3 years ago
10

5 write a recursive method that returns the number of 1's in the binary representation of n. use the fact that this is equal to

the number of 1's in the representation of n/2, plus 1, if n is odd.
Mathematics
1 answer:
ASHA 777 [7]3 years ago
7 0
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


You might be interested in
Can someone help me ?
vfiekz [6]

Answer:

The last answer choice is correct, I am pretty sure.

Just go on the calculator (like Desmos) and just use the decimals to determine which one is true.

8 0
4 years ago
Read 2 more answers
Idk how to do this can someone help?
Marat540 [252]
6799765vhjytddhiokjg
3 0
3 years ago
Is n = 4 a solution for n to the second power + 79 = 88? Explain.
Lana71 [14]
No. 4 squared is 16 and 16 + 79 is 85 not 88
8 0
3 years ago
Write an equation in slope-intercept form for the line that is parallel to the line y = -4x + 5 and that passes through the give
aivan3 [116]

Answer:

Y=4x-27

Step-by-step explanation:

Parallel lines have the same gradient therefore it's-4

Y-5/X--8 =-4

Y-5=-4(x+8)

Y-5=-4x+-32

Y=-4x-32+5

Y=4x-27

3 0
4 years ago
The measures of the angles of Triangular garden are in the ratio 2:5:5. What are the measures of the angles? Classify the triang
Darina [25.2K]

2x + 3x + 5x = 180

 

10x = 180

 

x = 18

 

2x = 36, 3x = 54, 5x = 90

 

They add up to 180 (definition of sum of angles of a triangle.)

6 0
3 years ago
Other questions:
  • 3/7 of a children's choir are boys, if there are 12 boys in the choir. How many children in total are in the choir?
    13·1 answer
  • During a job fair last year an employer spent 200 minutes interviewing people for jobs this year the employer wants to interview
    15·1 answer
  • Which is the solution to the system of equations?
    13·1 answer
  • A rotation is shown in the drawing:
    12·2 answers
  • HELP ASAP 3.) Andy's Karpet Kleaning charges a $23 consultation fee, plus $17 per hour to clean carpets. Stanley
    5·1 answer
  • The cost of 3 movie rentals and 7 boxes of candy is 16.60. The cost of 5 movie rentals and 2 boxes of candy is 13 how much does
    7·1 answer
  • Pls help me and pls explain how u got answer
    15·2 answers
  • Find the value of x with shown work​
    15·1 answer
  • Simplify the expression to a polynomial in standard form:<br> (−x+1)(x^2+6x−4)
    8·1 answer
  • 8th/9th-95 POINTS+BRAINLIEST!!!!!!!! How do you write a quadratic equation in vertex form? Please explain the steps in simple la
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!