Checking if a number X is a multiple of another number Y is easy when it...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Checking if a number X is a multiple of another number Y is easy when it is small enough to be stored in a variable of integer type (e.g., int, long int). We just have to check if the remainder of the division of X by Y is zero (i.e., X%Y=0). However, when the number is too large, this can be a tricky task. Luckily, when dealing with multiples of 11 (Y=11), there is another way of performing this check: if the difference of the sum of the digits at odd places and even places of X is 0 or a multiple of 11, then X is a multiple of 11 as well. Example #1: 3 Example # 2: 2 X=323455693 6 (3+3+5+6+3)-(2+4+5+9)=20-20-0 The difference is 0, thus X is a multiple of 11 X-31416 6 (3+4+6)-(1+1)-13-2-11 The difference is 11, thus X is a multiple of 11 Considering that X can be a very large number (up to 1000 digits), can you write a program that identifies multiples of 11? Checking if a number X is a multiple of another number Y is easy when it is small enough to be stored in a variable of integer type (e.g., int, long int). We just have to check if the remainder of the division of X by Y is zero (i.e., X%Y=0). However, when the number is too large, this can be a tricky task. Luckily, when dealing with multiples of 11 (Y=11), there is another way of performing this check: if the difference of the sum of the digits at odd places and even places of X is 0 or a multiple of 11, then X is a multiple of 11 as well. Example #1: 3 Example # 2: 2 X=323455693 6 (3+3+5+6+3)-(2+4+5+9)=20-20-0 The difference is 0, thus X is a multiple of 11 X-31416 6 (3+4+6)-(1+1)-13-2-11 The difference is 11, thus X is a multiple of 11 Considering that X can be a very large number (up to 1000 digits), can you write a program that identifies multiples of 11?
Expert Answer:
Related Book For
Managerial Accounting Tools for Business Decision Making
ISBN: 978-1118033890
3rd Canadian edition
Authors: Jerry J. Weygandt, Paul D. Kimmel, Donald E. Kieso, Ibrahim M. Aly
Posted Date:
Students also viewed these computer network questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Which of the following do ergonomics most directly address? Physical wellbeing Mental wellbeing Emotional wellbeing Social wellbeing
-
Google now commands 70% of search advertising on the Internet. Is Google in violation of antitrust laws?
-
A closed system consists of 0.5 kmol of ammonia occupying a volume of 6 m3. Determine (a) The weight of the system, in N, and (b) The specific volume, in m3/kmol and m3/kg. Let g= 9.81 m/s2.
-
Use the information from the balance sheet and income statement below to calculate the following ratios: Current ratio Acid-test ratio Times interest earned Inventory turnover Total asset turnover...
-
The Giant Farmer Company processes food for sale in discount food stores. ft has two plants: one in Chicago and one in Houston. The company also operates warehouses in Miami. Florida: Denver,...
-
1. Identify the product which represents the solid state in the above reaction. a) Barium chloride b) Barium sulphate c) Sodium chloride d) Sodium sulphate 2. The colour of the solution observed...
-
Light-It-Up Company maintains and repairs warning lights, such as those found on radio towers and lighthouses. Light-It-Up Company prepared the following end-of-period spreadsheet at August 31, 20Y5,...
-
9.30 A fighter jet aircraft has the following characteristics: mro 10,000 kg, S=24 m, b= 8 m, T = 100 KN, e=0.8, CD = 0.015 (low subsonic), Do CDo 0.03 (transonic); Co= 0.042 (supersonic), CLmax =...
-
Inez files an employment discrimination suit against Jiffy Delivery Service, under Title VII of the Civil Rights Act, based on Jiffys discharge of Inez. If Inez prevails in her prima facie case, one...
-
Meg wants to give Lori a pair of diamond earrings that Meg has in her safe-deposit box at First National Bank. Both Lori and Meg are signatories for that safe deposit box. Meg gives Lori the key to...
-
An automatic stay is a suspension of all judicial proceedings on the occurrence of an independent event. (True/False)
-
Benas files a bankruptcy petition under Chapter 7 to have his debts discharged. If Benas plan is approved, the debts most likely to be discharged include claims for a. back taxes accruing within...
-
When two secured parties have perfected security interests in the same collateral, generally the last to perfect has priority. (True/False)
-
1. Why is it important to build a community with a prescribed vision within the AR project? Describe a time when developing a coherent community was important. 2. Describe the strategic plan of your...
-
1. What are some current issues facing Saudi Arabia? What is the climate for doing business in Saudi Arabia today? 2. Is it legal for Auger's firm to make a payment of $100,000 to help ensure this...
-
The Allbright BrickWorks, in Winnipeg, manufactures high-quality bricks used in residential and commercial construction. The firm is small but highly automated and typically produces about 300,000...
-
Waterways Corporation has recently acquired a small manufacturing operation in British Columbia that produces one of its more popular items. This plant will provide these units for resale in retail...
-
The condensed income statement for the Phan and Nguyen partnership for 2012 is as follows: A cost behaviour analysis indicates that 75% of the cost of goods sold is variable, 50% of the selling...
-
Explain how corporations provide limited liability to their owners.
-
Explain the steps in forming a limited liability corporation.
-
Explain the role played by a board of directors of a corporation.
Study smarter with the SolutionInn App