Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 There is a method to multiply two arbitrary integer numbers greater than zero using multiplication by two, integer division by two and addition. This

image text in transcribed

3 There is a method to multiply two arbitrary integer numbers greater than zero using multiplication by two, integer division by two and addition. This method is as follows Given two integer numbers greater than 0: -write each of the two numbers at the top of a column - multiply by two the number in the first column and divide by two the number in the second column using integer division if the number in the second column is even, cross out the numbers in that row continue multiplying and dividing until the number in the second column is 1 add the numbers in the first column that were not crossed out. The result of this addition is the multiplication of the two given numbers For instance, with the numbers 34 and 22 this method yields the following values 34 22 68 11 136 5 272 2 544 1 748 Write a Python program to multiply two integers greater than zero using the method described above. The output of your program with the instance 34 and 22 should look like this The numbers to be multiplied are 34 and 22 34 22 (ignore this row) 6811 (keep this row) 5 (keep this row) 136 272 544 2 (ignore this row) 1 (keep this row) The product is 748 (4 pts) Encode your algorithm in Python and label its output appropriately and (1 pt) Run your program with the instance 17 and 48

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions