Question

In: Computer Science

Write 6 paragraphs Describing the algorithms that are actually used by modern computers to add, subtract,...

Write 6 paragraphs Describing the algorithms that are actually used by modern computers to add, subtract, multiply and divide positive integers.

Solutions

Expert Solution

Modern computers reprsent data in the form of binary digits such as 0 and 1.which intern grouped into bytes.adding ,subtraction,multiplication and division are in the format of binary representations only.so we have to convert from decimal to binary format.

For conversion we have to store reaminder when the number is divided by 2 in the array.and next we have to divide that number by 2.we have to repeat this procedure until the number is greater than zero.then we have to print that array in reverse order.

The addition algorithm takes two operands(it is the data an algorithm operates on) and produces one result.adding two bits in one column may produce a carry bit.this is the carryin for the next bit column.when we add 1 and 1 we will get 10 and 1 is the carry bit.it is the carry in to the next column.

The subtraction algorithm takes two operands A and B.complement B to produce 2's complement of B.then add A and complement B then invert the bits and add 1.

The multiplication algorithm takes operands A and B (MULTICAND AND MULTIPLIER).the multiplicand is shifted and next bit of multiplier is examined it is also a shifting step.if this bit is 1,shifted multiplicand is added to the product.

The division algorithm takes the remainder r,the divisor d,and quotient q, at every step shift divisor right and compare it with current dividend.if divisor is larger,shift 0 as the next bit to the quotient.if the divisor is smaller,substract to get new dividend and shift 1 as the next bit of the quotient


Related Solutions

C++ For this assignment, you will write a C++ program to either add (A), subtract (S),...
C++ For this assignment, you will write a C++ program to either add (A), subtract (S), multiply (M), and (N), or (O) two matrices if possible. You will read in the dimensions (rows, then columns) of the first matrix, then read the first matrix, then the dimensions (rows then columns) of the second matrix, then the second matrix, then a character (A, S, M, N, O) to determine which operation they want to do. The program will then perform the...
Write a calculator program that prompts the user with the following menu: Add Subtract Multiply Divide...
Write a calculator program that prompts the user with the following menu: Add Subtract Multiply Divide Power Root Modulus Upon receiving the user's selection, prompt the user for two numeric values and print the corresponding solution based on the user's menu selection. Ask the user if they would like to use the calculator again. If yes, display the calculator menu. otherwise exit the program. EXAMPLE PROGRAM EXECUTION: Add Subtract Multiply Divide Power Root Modulus Please enter the number of the...
Write a python program to display a menu with the following options: (1) add, (2) subtract,...
Write a python program to display a menu with the following options: (1) add, (2) subtract, (3) multiply, (4) divide (5) mod, and (6) do nothing. I f the user enters something else (except 1-6), the program should display an error message. Otherwise, it should ask the user for two numbers, perform the calculation, and display the result.
Using Java Write a simple calculator which can add, subtract, multiply, and divide. Here are the...
Using Java Write a simple calculator which can add, subtract, multiply, and divide. Here are the specifications for the calculator: The calculator has one “accumulator”, which holds the result of all prior calculations. The calculator is set to 0.0 when the calculator is turned on (i.e., instantiated). On the console, the user then enters an operator (+, -, *, or /) and a number. Your console will then apply the operator and operand to the number in the accumulator, and...
6. Add using binary addition 26 and 56 45 and 65      7. Subtract using binary...
6. Add using binary addition 26 and 56 45 and 65      7. Subtract using binary two’s complement 23 from 45 34 from 65
1. Explain how threads are used by the CPU to process tasks by describing a modern...
1. Explain how threads are used by the CPU to process tasks by describing a modern example, e.g., the multi-core mobile phone that you use every day has an interesting organisation of threads. However, it can be any other modern example of hardware that uses ―threads. 2. There are a number of techniques used by CPU designers to improve the performance of their processors. However, these optimisation strategies do not always work – for some workloads, they may have no...
Write one to two paragraphs describing the role of insulin in the metabolism of glucose, fat,...
Write one to two paragraphs describing the role of insulin in the metabolism of glucose, fat, and protein. Also, discuss how insulin is related to the manifestations of diabetes.
What encryption/decryption and hashing algorithms are used in PGP and how are they used? write at...
What encryption/decryption and hashing algorithms are used in PGP and how are they used? write at least 500 words of your explanation and reference.
Write 3 paragraphs describing the valves in the heart, and name all 4 valves and where...
Write 3 paragraphs describing the valves in the heart, and name all 4 valves and where blood flows coming into and out of each valve.
1. Write a couple (2) of paragraphs describing the origin of both the continuous background spectrum...
1. Write a couple (2) of paragraphs describing the origin of both the continuous background spectrum and the dark lines in the solar spectrum.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT