You are asked to develop C and Assembly programs separately that computes the square of a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You are asked to develop C and Assembly programs separately that computes the square of a provided integer number N, i.e.., N². Algorithm: The number N should be multiplied by 2 as required. Then the program adds the lacking term to the previously multiplied part or subtracts the residual term from the previously multiplied part. For instance, program decides to add lacking term if there are less than or equal to k additions in the second part where ke N. Otherwise, program uses the subtraction of residual term process. This decision is important for a faster execution speed. Example: Let's consider N = 30 is given and the square of this number is asked to be found by using above algorithm. The decision number k = 8 in this example. or The program can compute the square of a given N in two different ways: (30×2×2×2×2) + (30+30+...+30) 14x30 (30×2×2×2×2× 2) - (30+30). 2x30 (2) The program decides to use (2) since the second term requires only 2 <k additions while (1) requires 14 > k additions. You are asked to develop C and Assembly programs separately that computes the square of a provided integer number N, i.e.., N². Algorithm: The number N should be multiplied by 2 as required. Then the program adds the lacking term to the previously multiplied part or subtracts the residual term from the previously multiplied part. For instance, program decides to add lacking term if there are less than or equal to k additions in the second part where ke N. Otherwise, program uses the subtraction of residual term process. This decision is important for a faster execution speed. Example: Let's consider N = 30 is given and the square of this number is asked to be found by using above algorithm. The decision number k = 8 in this example. or The program can compute the square of a given N in two different ways: (30×2×2×2×2) + (30+30+...+30) 14x30 (30×2×2×2×2× 2) - (30+30). 2x30 (2) The program decides to use (2) since the second term requires only 2 <k additions while (1) requires 14 > k additions.
Expert Answer:
Answer rating: 100% (QA)
C include int squareint v int result 1 int k 8 Decision number Multiply by 2 repeatedly while k 0 result 2 k Add or subtract the remaining term if k 0 result v else result v return result int main int ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these computer network questions
-
3. Show the binary search tree which would be constructed to store each of the following list of identifiers: sum, x3, count, x210, x, x33
-
Sirlin Co., a CCPC that is not associated with any other corporation, had taxable income in the current year of $700,000, consisting of ABI of $600,000 and AII of $100,000. Sirlin also received total...
-
You are asked to develop a multiple regression model that indicates the relationship between a person's behavioral characteristics and the daily cost of food (daily cost). The predictor variables to...
-
After the car reaches 1 0 0 km / hthe driver immediately steps on the brakes and comes to a stop in 2 . 5 5 s . The brakes are at a distance 1 5 . 9 cm from the center of the wheel and the force they...
-
Consider Figure 14-2. The years immediately after 2008 stand out as having the highest values in the figure. The main reason is that the dollar magnitudes of the federal government's deficits were...
-
Algeria Transport Company has average invested capital of $800,000 and a target return on investment of 15%. The total cost per unit is $20 based on a volume level of 25,000 units. Albany's markup...
-
What are three basic methods for allocating factory overhead costs?
-
Milt Pearson, the president of Supergrip Corporation Limited (SCL), is concerned with the results achieved by SCL for the fiscal year ended May 31, 2010, and has called a meeting of the Executive...
-
Define the term Agile supply chain. How Agile supply chain different from the traditional supply chain? Explain
-
An army division in Iraq has five troop encampments in the desert, and the division leaders want to determine the best location for a supply depot to serve the camps. The (x, y) coordinates (in...
-
On April 1, Jose Garcia created a new travel agency, Garcia Travel. The following transactions occurred during the companys first month. Apr. 1 Garcia invested $38,000 cash and computer equipment...
-
Discuss the sections or paragraphs that might be found in a formal written report.
-
What factors can you think of that may affect the width of a confidence interval? In what way does each factor affect the width?
-
List three forms of formal reporting of an operational audit's results.
-
Organizations that issue standards affecting governmental audits include all of the following except the a. SEC. b. AICPA. c. OMB. d. GAO.
-
What was the purpose of the Commission on Auditor's Responsibilities?
-
Brady Bell, Inc. has a cost of capital of 11 percent and is invested in a project that has the following cash flows over the next 6 quarters. If interest is compounded quarterly. what is the...
-
Research corporate acquisitions using Web resources and then answer the following questions: Why do firms purchase other corporations? Do firms pay too much for the acquired corporation? Why do so...
-
Frederick (Freddy) Freeweights (age 42) owns and operates a health club called ''Treadmills West.'' The business is located at 4321 Arnold Street, Alpine, CA 91901. Freddy had the following income...
-
a. Wilson filed his individual tax return on the original due date, but failed to pay $700 in taxes that were due with the return. If Wilson pays the taxes exactly 2 months late, calculate the amount...
-
Bea Jones (age 32) moved from Texas to Florida in December 2011. She lives at 654 Ocean Way, Gulfport, FL 33707. Bea's Social Security number is 466-78-7359 and she is single. Her earnings and income...
-
Herberger Oil & Gas Company paid \($10\) million for the drilling rights to a 1,000 acre tract of land near Midland, Texas. On the basis of several exploratory wells that had cost an aggregate of...
-
Intelligencia Inc. was incorporated as a research and development company in the biotechnology industry. The company incurred the following costs relating to various intangible assets: 1. During the...
-
Global Music Enterprises, Inc., had a balance sheet loaded with intangible assetscopyrights on music, goodwill from various prior acquisitions, and internet customer lists purchased from other online...
Study smarter with the SolutionInn App