Binary is a base-2 number system instead of the decimal (base-10) system we are familiar with. Write a recursive function PrintInBinary(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

Answers

Answer 1

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

if (num == 0)  

 return 0;  

If otherwise, see below for further explanation

else

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

}

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

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


Related Questions

Have you ever tried using such a camera?​

Answers

Answer: yeah i mean i use my canon camera

Explanation:

Write a SELECT statement that returns one row for each customer that has orders with these columns: The email_address from the Customers table

A count of the number of orders

The total amount for each order

(Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.) Return only those rows where the customer has more than 1 order. Sort the result set in descending sequence by the total amount . Hint: You will join three tables together. Returns 3rows of data.

Questions done up until #4: https://pastebin.com/LwSKknPi

all questions before and after:

Write a SELECT statement that returns these columns:

The count of the number of orders in the Orders table

The sum of the tax_amount columns in the Orders table

Returns 1 row of data.

Write a SELECT statement that returns one row for each category that has products with these columns:

The category_name column from the Categories table

The count of the products in the Products table

The list price of the most expensive product in the Products table

Sort the result set so the category with the most products appears first.

Hint: You will join two tables together. Returns 3 rows of data.

Write a SELECT statement that returns one row for each customer that has orders with these columns:

The email_address column from the Customers table

The sum of the item price in the Order_Items table multiplied by the quantity in the Order_Items table

The sum of the discount amount column in the Order_Items table multiplied by the quantity in the Order_Items table

Sort the result set in descending sequence by the item price total for each customer.

Hint: You will join three tables together. Returns 7 rows of data.

Modify the solution to exercise 4 so it only counts and totals line items that have an item_price value that’s greater than 400. Returns 2 rows of data.

Write a SELECT statement that answers this question: What is the total amount ordered for each product? Return these columns:

The product name from the Products table

The total amount for each product in the Order_Items (Hint: You can calculate the total amount by subtracting the discount amount from the item price and then multiplying it by the quantity)

Use the WITH ROLLUP operator to include a row that gives the grand total.

Hint: You will join two tables together. Returns 10 rows of data.

Write a SELECT statement that answers this question: Which customers have ordered more than one product? Return these columns:

The email address from the Customers table

The count of distinct products from the customer’s orders

Hint: You will join three tables together. . Returns 3 rows of

Answers

Answer:

Please find the attachment files of the queries:

Explanation:

In the all queries the select statement is used that selects the defined columns and use the function like sum, join, orderby, and groupby to perform the various operations, in which the sum is used to add columns or rows values, join is used for joining two or more tables, and orderby is used for return the table into ascending or descending order, and groupby is used for the count the value, calculate average and perform other operation and gives its return value.

____________ reference is used when you want to use the same calculation across multiple rows or columns.

Answers

Answer:

relative cell

Explanation:

So, if you want to repeat the same calculation across several columns or rows, you need to use relative cell references. For example, to multiply numbers in column A by 5, you enter this formula in B2: =A2*5. When copied from row 2 to row 3, the formula will change to =A3

Answer:

Relative

Explanation:

Relative  reference is used when you want to use the same calculation across multiple rows or columns.

Online, it is easy to think of communication as “computer to ____________” rather than “_________ to ___________”.
a.
person, computer, person
b.
computer, person, computer
c.
person, person, person
d.
computer, person, person

Answers

I would say D but if not I’m terribly sorry

Hope this helps

Have a great day/night

Online, it is easy to think of communication as “computer to computer” rather than “person to person”. Thus, option D is correct.

What is communication?

It is possible to describe communication as the act of passing the information between one person or group of people to the next. Communicating facilitates easy understanding of what a different person is trying to say or convey. There are two forms of communication: both verbal and nonverbal.

With the help of communication the person can tell and feature tthe data between the person and an group. In this, that data is given to the people and the data is not given to the person but it is rather given to the person. As this data is been transferred from one computer to another and then it reaches the people.

Therefore, option D is the correct option.

Learn more about communication, here:

https://brainly.com/question/22558440

#SPJ2

2. It is the art of creating computer graphics or images in art, print media, video games.
ins, televisions programs and commercials.

Answers

the answer is CGI :)


When you
you can use the diverse knowledge sets of a team and share a workload.
O strategize
O quantify
discriminate
I
O collaborate

Answers

Answer:

Collaborate.

Explanation:

It was correct for me!

Answer:collaborate

Explanation:

cs edgen 100%

Which term describes the surrounding area of this image?

The surrounding area of this image is called
Surroundings
Foreground
Background

This area is also called a
Negative
Positive
Neutral

Answers

Answer: background/negative

Explanation: the background, is negative space. A solid piece of sculpture occupies space, and makes the space around it come to life.

which internet service is the main reason the internet has expanded and what draws newcomers to the internet?

Answers

Answer:

It has spread throughout the world since it is a very useful tool since most things are facilitated, thus leading to a much more efficient daily life, which is why the internet is one of the main means for the functioning of the world today. day, as new technologies have revolutionized

Social media.

The term social media refers to those digital tools that facilitate the transmission of information, communication and social interaction between individuals. Thus, social media allows individuals to relate to each other, in a similar way as if they were physically interacting, but through computer means.

These social media can be from profiles on social networks to blogs, podcasts or even videos on digital platforms. In short, nowadays social media is an integral part of people's social life, and it is in many cases what ends up driving them to use the internet.

Learn more in https://brainly.com/question/21765376

You should write the client so that it sends 10 ping requests to the server, separated by approximately one second. Each message contains a payload of data that includes the keyword PING, a sequence number, and a timestamp. After sending each packet, the client waits up to one second to receive a reply. If one second goes by without a reply from the server, then the client assumes that its packet or the server's reply packet has been lost in the network.Hint: Cut and paste PingServer, rename the code PingClient, and then modify the code. The two programs follow very similar process.You should write the client so that it starts with the following command:java PingClient host portwhere host is the name of the computer the server is running on and port is the port number it is listening to. Note that you can run the client and server either on different machines or on the same machine.The client should send 10 pings to the server. Because UDP is an unreliable protocol, some of the packets sent to the server may be lost, or some of the packets sent from server to client may be lost. For this reason, the client cannot wait indefinitely for a reply to a ping message. You should have the client wait up to one second for a reply; if no reply is received, then the client should assume that the packet was lost during transmission across the network. You will need to research the API for DatagramSocket to find out how to set the timeout value on a datagram socket.When developing your code, you should run the ping server on your machine, and test your client by sending packets to localhost (or, 127.0.0.1). After you have fully debugged your code, you should see how your application communicates across the network with a ping server run by another member of the class.Message FormatThe ping messages in this lab are formatted in a simple way. Each message contains a sequence of characters terminated by a carriage return character (r) and a line feed character (n). The message contains the following string:PING sequence_number time CRLFwhere sequence_number starts at 0 and progresses to 9 for each successive ping message sent by the client, time is the time when the client sent the message, and CRLF represent the carriage return and line feed characters that terminate the line.

Answers

Answer:

figure it out urself

Explanation:

h. What is recycle bin?
->​

Answers

Answer:

Trash application, the Recycle Bin

lower cabinet is suitable for storing and stocking pots and pans true or false​

Answers

True.
Make sure cabinet is clean enough to put the pots and pans.

Practice Question

What will be displayed after this

code segment is run?

count

0

REPEAT UNTIL (count = 3

count count + 1

DISPLAY

and"

DISPLAY count



"1 and 2 and 3"

"And 1 and 2 and 3"

"0 and 1 and 2"

"And 0 and 1 and 2"

Answers

Answer:

Follows are the code to the given question:

#include <stdio.h>//header file

int main()//main method

{

int count=0;//defining an integer variable

for(count=0;count<3;count++)//use for loop to count values

{

printf("%d\n",count);//print count values

}

return 0;

}

Output:

0

1

2

Explanation:

In this code, it declares the integer variable "count" which has a value of "0" and in the next step declares a loop, using the count variable to regulate count values, which is less than 3, and increases the count value, and prints its values. This variable is the count value.

The count variable holds a value of 0, and use a for loop that checks its value is less than 3, and print its value, that's why it will print the value that is 0,1, and 2.

Other Questions
Organism without a definite nucleus Rewrite the function by completing the square.f(x) = x^2 + 14x + 64 What equation can be used to find A? 6. Which of the process would you use to remove saltdissolved in water?opicean .Filtration, evaporation, chlorination anyone live in stockton cali answer this. ITS NOT LONG OR HARD, PLZ HELP! Identify 5 open ended questions from this essay. This war was fought between America and Great Britain which started in the year 1812. It was in this war, that the American expansionist attempts to the north would be halted. The war was a huge loss to the American Indians who sought to fight and keep them on their land but would loose and their land was taken (Housman, Reginald). It is ironic, however, that this war ended in a stalemate having not benefited the parties that were taking in it. America did not occupy Canada as it hoped and neither did Great Britain, the colonial master of Canada acquire America.Before the war of 1812, the British were engaged in the Napoleonic war against Napoleon of France in the Napoleonic wars. America sought to be neutral on the issue and its involvement at the time became only through trade. The British, however, instituted blockades and trade restrictions preventing American sailors from trading with the enemies of British i.e. French. This was an unfair move and was deemed to be an attack on the sovereignty of America and international laws(Reginald, 2017). The British would also force the American ships to first dock in the British ports and get a license before trading with any European nation. They made the American sailors join the British army, a move met with a lot of criticism and protest by the Americans against the British. The British were impressing the sailors were looking for British nationals who were avoiding the army by boarding American ships.The War of 1812 pitted the young United States in a war against Great Britain, from whom the American colonies had won their independence in 1783. Press gangs, though ostensibly targeting British subjects for naval service, also swept up 6,000 to 9,000 Americans into the crews of British ships between 1803 and 1812. Andrew Jackson defeats the Creek Indians in the battle of Horseshoe Bend (Mississippi Territory). The British plan a three-part invasion of US: Chesapeake Bay, Lake Champlain, & the mouth of Mississippi River. The British are turned back at Baltimore harbor. The British burn the White House in Washington, D.C. War of 1812, (June 18, 1812February 17, 1815), conflict fought between the United States and Great Britain over British violations of U.S. maritime rights. It ended with the exchange of ratifications of the Treaty of Ghent. Causes of the War of 1812 Maritime Issues. Impressment was the most volatile issue between the United States and Britain. Expansionism. The division of land after the Revolution did not leave everyone satisfied.Political. Who won War of 1812? British ,The British won, despite what Americans may think. The British kept Canada, as well as the maritime policies that Americans say were the reason for the war. Why was the war of 1812 significant to the United States? Although often treated as a minor footnote to the bloody European war between France and Britain, the War of 1812 was crucial for the United States. Second, the war allowed the United States to rewrite its boundaries with Spain and solidify control over the lower Mississippi River and the Gulf of Mexico. 10 PointsI need help ASAP!!! The main idea of "Richard Whittington and His Cat" is "_____."cats are great helpersa cat helped an orphan boy become richdo not believe stories about gold streets in LondonHELP ASAP QUICK How do archeologists now propose that people spread south whats the slope_____ Please help with 3 thank you! What is khando jagaune the barometer is used to measure temperature. ( True, False ) HELP!!!! choose the spanish subject pronoun that would replace the given subject which of the following stands out in native american culture compared to the cultures of early mesoamerican civilizations? a) craftsmanshipb) weaponry c) polytheism d) oral tradition Cameron combined peanuts, cashews and walnuts to make a trail mix. The expression 16p+24c+32w represents the total number of nuts in the mix. Cameron wants to divide the trail mix into equal servings, but he does not know how many. Use factoring to write expressions that will help Cameron divide the trail mix into 4 servings or 8 servings. Which statement is true about the fossil record? A. The fossil record shows that organisms have changed very little over time. B. The fossil record is inconsistent with the scientific theory of evolution. C. The fossil record is very limited and offers little knowledge about the history of life. D. The fossil record shows how different groups of organisms have changed over time. PLEASE HELP!!! WILL GIVE BRAINLIESTWhich list of attributes makes an anecdote a good source of support in a reflective essay?A.)formal, purposeful, and ordinaryB.)general, short, and impersonalC.)personal, insightful, and persuasiveD.)fictional, humorous, and unexpected pregn de serviciokjjj Before work can begin on the project, the customer must Group of answer choices sign a contract with the contractor that includes the project start date and payment plan. assess the risks for completing the project on time and reduce the award amount if there is any risk. announce who won the bid for the project so the work can start immediately. contact the contractor and say the project is the winner so the work can start immediately.