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
bagirrra123 [75]
3 years ago
10

Binary is a base-2 number system instead of the decimal (base-10) system we are familiar with. Write a recursive function PrintI

nBinary(int num) that prints the binary representation for a given integer. For example, calling PrintInBinary(5) would print 101. Your function may assume the integer parameter is non-negative. The recursive insight for this problem is to realize you can identify the least significant binary digit by using the modulus operator with value 2. For example, given the integer 35, mod by 2 tells you that the last binary digit must be 1 (i.e. this number is odd), and division by 2 gives you the remaining portion of the integer (17). What 's the right way to handle the remaining portion
Computers and Technology
1 answer:
Paladinen [302]3 years ago
7 0

Answer:

In C++:

int PrintInBinary(int num){

if (num == 0)  

 return 0;  

else

 return (num % 2 + 10 * PrintInBinary(num / 2));

}

Explanation:

This defines the PrintInBinary function

int PrintInBinary(int num){

This returns 0 is num is 0 or num has been reduced to 0

<em> if (num == 0)  </em>

<em>  return 0;  </em>

If otherwise, see below for further explanation

<em> else </em>

<em>  return (num % 2 + 10 * PrintInBinary(num / 2)); </em>

}

----------------------------------------------------------------------------------------

num % 2 + 10 * PrintInBinary(num / 2)

The above can be split into:

num % 2 and + 10 * PrintInBinary(num / 2)

Assume num is 35.

num % 2 = 1

10 * PrintInBinary(num / 2) => 10 * PrintInBinary(17)

17 will be passed to the function (recursively).

This process will continue until num is 0

You might be interested in
Which of the following is a sigh that your computer may have been infected with malicious code
taurus [48]

Slow computer, blue screen, Programs opening and closing automatically, Lack of storage space, Suspicious modem and hard drive activity, Pop-ups, websites, toolbars and other unwanted programs, or spam.

4 0
3 years ago
I make a budget of my 1st Gamer PC its good?
svet-max [94.6K]

Answer:

Good start

Explanation:

I'm not <em>super</em> knowledgeable about computer hardware but the 16gb of ram seems like a good decision but the biggest thing I reccomend is allocating more money towards storage. Even just getting a normal HDD for your games might be a good idea because the newest CoD game is 84gb so you will fill that SSD up quicky.

8 0
3 years ago
The __________ is a visual or textual storyboard that will assist in determining the type of web pages on your site.
Alex787 [66]

The<u> WEBSITE STORYBOARD</u> is a visual or textual storyboard that will assist in determining the type of web pages on your site.

Explanation:

  • A Website storyboard is a visual representation of your websites structure. It relates out all the components of your site and how they related.
  • Creating a website storyboard can help you plan and organise your website and even plan the internal linking structure between pages.
  • A storyboard is a graphic organizer that consists of illustrations or images displayed in sequence for the purpose of pre-visualizing a motion picture, animation, motion graphic or interactive media sequence.
  • The storyboard is a very important part of the pre production process as it clearly conveys how the story will flow
  • Storyboard allows you to see potential problems that would not go unnoticed saving time and money.
  • Storyboards are more useful when trying to articulate to someone else  what the shot should look like so they know how to make it work.

7 0
3 years ago
What is a header row?
777dan777 [17]

Answer:

b. the top row of a table that shows titles for the cells below

Explanation:

A header row is the first row of a given table that shows titles of the cells below it. In many cases, the header row has different styles from the other rows in the table. A header row can be found in, among others, both Microsoft's Excel and Word applications.

In the attached figure, the first row with a darker shade of background color is the header row for the table.

8 0
2 years ago
8.
mario62 [17]

Answer:

<em>Lillipop</em>

Explanation:

If you have your hands correctly placed on the keyboard, the only hand needed to type the word, "lillipop", is the left hand!

<em>Hope I was of Assistance</em><u><em> #SpreadTheLove <3</em></u>

5 0
2 years ago
Other questions:
  • A commonly used font style is _____. superscript periwinkle times new roman point
    7·1 answer
  • 10 points (sorry it won’t let me do more points)
    10·1 answer
  • What is a strictly layered pattern, provide an example of its usage.
    13·1 answer
  • Show the stack with all activation record instances, including static and dynamic chains, when execution reaches position 1 in t
    6·1 answer
  • Why does brainly keep saying “oops... something went wrong! Try again”
    7·2 answers
  • I need to reverse a inputted word using for loops with range 0 to the input word and increment 1.
    5·1 answer
  • You are responsible for a rail convoy of goods consisting of several boxcars. You start the train and after a few minutes you re
    8·1 answer
  • Compare mini and mainframe computer in terms of speed,memory and storage​
    15·1 answer
  • The ratio of sparrows to bluejays at the bird sanctuary was 5 to 3 If there were 15 bluejays in the sanctuary, how many sparrows
    12·1 answer
  • What are benefits of AI
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!