Problem 2: The following pseudocode and flowchart have been designed to get an integer number from...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Problem 2: The following pseudocode and flowchart have been designed to get an integer number from the user and print if it is a perfect number or not. Note: a perfect number is a positive integer which is equal to the sum of its proper divisors, excluding itself. For example 6 and 28 are perfect numbers because 6=1+2+3 and 28=1,2,4,7,14. 1: Start 2: num-0 3: sum=1 4: divider - 2 5: Read (num) 6: While ((num/2) >- divider) DO 7: IF (num% divider=0) Then 8: sum-sum+ divider End IF divider=divider + 1 9: 10: 11: End While 12: IF (num=sum AND num != 1) Then 13: Print (num," is a perfect number.") 14: Else Print (num," 15: 16: End IF 17: End. OUTLY is not a perfect number.") B sum sum + divider Start B num = 0 "Input a positive PUT num+ is a perfect number. sum = 1 divider = 2 integere:" num % divider=0 GETmum divider divider + 1 Loop (num/2) > divider Yes sum-num End PUT num+ "is not a perfect number. T A) Trace the algorithm for the following values and show the output: 25, 1, 0, 6, 28 B) Modify the psuedocode or the flowchart in order to print out all the perfect numbers between a range of values given by the user, like 1 and 1000. Problem 2: The following pseudocode and flowchart have been designed to get an integer number from the user and print if it is a perfect number or not. Note: a perfect number is a positive integer which is equal to the sum of its proper divisors, excluding itself. For example 6 and 28 are perfect numbers because 6=1+2+3 and 28=1,2,4,7,14. 1: Start 2: num-0 3: sum=1 4: divider - 2 5: Read (num) 6: While ((num/2) >- divider) DO 7: IF (num% divider=0) Then 8: sum-sum+ divider End IF divider=divider + 1 9: 10: 11: End While 12: IF (num=sum AND num != 1) Then 13: Print (num," is a perfect number.") 14: Else Print (num," 15: 16: End IF 17: End. OUTLY is not a perfect number.") B sum sum + divider Start B num = 0 "Input a positive PUT num+ is a perfect number. sum = 1 divider = 2 integere:" num % divider=0 GETmum divider divider + 1 Loop (num/2) > divider Yes sum-num End PUT num+ "is not a perfect number. T A) Trace the algorithm for the following values and show the output: 25, 1, 0, 6, 28 B) Modify the psuedocode or the flowchart in order to print out all the perfect numbers between a range of values given by the user, like 1 and 1000.
Expert Answer:
Related Book For
Business Statistics For Contemporary Decision Making
ISBN: 978-1118749647
8th edition
Authors: Black Ken
Posted Date:
Students also viewed these programming questions
-
For each, decide if it is a vector space, the intended operations are the natural ones. (a) The diagonal 2 2 matrices (b) This set of 2 2 matrices (c) This set (d) The set of functions {f : R R |...
-
For each, decide if it is a set of isomorphism class representatives. (a) {Ck | k N} (b) {Pk | k {- 1, 0, 1, . . .}} (c) {Mmn | m, n N}
-
(b) The following molecules have been designed to have activity at acetylcholine receptors. With the aid of diagrams, discuss their structures and predict which type of receptor each molecule...
-
1. Is religious training mandatory at all of the schools in question? 2. Does the Court see inevitable church-state entanglements if the Board were allowed to exercise jurisdiction over teachers in...
-
What is the most recent exposure draft or accounting standards update for accounting for derivatives? What database helped you find an answer?
-
SCHEDULE FOR CALCULATION OF CASH GENERATED FROM OPERATING ACTIVITIES Using the information provided in Problem 23-9B for Kennington Company, prepare the following: 1. A schedule for the calculation...
-
True or False: The following annual cash flows in years 1 thru 7, respectively, have a single real positive-valued root: \(-\$ 100,+\$ 15,-\$ 25,+\$ 75,-\$ 10,+\$ 50\), \(+\$ 50\).
-
JOB ORDER COSTING TRANSACTIONS B & L Enterprises makes garage doors. During the month of February, the company had four job orders: 303, 304, 305, and 306. Overhead was applied at predetermined...
-
The KLM Partnership, which uses the accrual method of accounting, is owned equally by Karen ( cash method taxpayer ) , and LM corporation ( accrual method taxpayer ) . Karen is a real estate...
-
Q: A Howe scissors roof truss is loaded as shown. Determine the force in members DF, DG, and EG. 1.6 kips 1.6 kips 1.6 kips 1.6 kips 0.8 kip 1.6 kips 0.8 kip6 ft D. H B G L4.5 ft E A K 8 ft 8 ft 8...
-
Upon investment, your group as an investor will also incur and pay an additional 10% commission fee and other related transaction costs. You choose 3 companies with a combined investment cost of...
-
A parent company adopts an HRM strategy that would allow overseas subsidiaries to perform their HRM functions autonomously. Critically evaluate strategies that support this approach and explain the...
-
What are workplace Communication Styles Exhibited by Men and Women?
-
What is the purpose of a mass interview? Be specific with your answer.
-
How has the role of HRM changed in recent years? Discuss three trends that are changing the HRM function. Why have these roles changed?
-
Compare and contrast the various worker's representation models that exist in Japan and United States of America. Give examples related.
-
6. Evaluate f(xy + y + 2)dxdy. Solution: 7. Evaluate the following integral using Bernoulli's method of integration fxedx Solution:
-
Consider the circuit of Fig. 7.97. Find v0 (t) if i(0) = 2 A and v(t) = 0. 1 3 ett)
-
Using problem 11.8, compute Tukeys HSD and determine whether there is a significant difference in means by using this methodology. Let = .05. 1 .. 2 27 ... 22 31 ... 27 31 ... 25 29 ... 23 30 ... 26...
-
Interpret the following Excel output. Discuss the structure of the experimental design and any significant effects. Alpha is.05. Anova: Two-Factor with Replication ANOVA Source of Variation SS df MS...
-
Current Construction Reports from the U.S. Census Bureau contain data on new privately owned housing units. Data on new privately owned housing units (1000s) built in the West between 1980 and 2010...
-
In a large office building, there is a woman dead in her locked office, sitting at her desk. Except for the desk, chair, and contents on the desk, the office is empty and the air conditioner is...
-
How many birthdays does the average person have?
-
A murderer is condemned to death. He has to choose between three rooms. The first is full of raging fires, the second is full of assassins with loaded guns, and the third is full of lions that havent...
Study smarter with the SolutionInn App