Programming and Problem Solving With C++
6th Edition
ISBN: 9781449694265
Author: Nell Dale
Publisher: Jones & Bartlett Learning
expand_more
expand_more
format_list_bulleted
Question
Chapter 1, Problem 3CSF
Program Plan Intro
To create an
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
On the planet Tatooine, droids do computations in base-6.
What is the greatest base-6 number with three different digits?
(Your base-6 number must have a separate digit for each digit.)
Make a decimal out of your answer (base-10).
Design an algorithm for determining the day of the week of any date since January 1, 1700. For example, August 17, 2001 was a Friday.
The Famous Gauss
You must know about Gauss, the famous mathematician. Back in late 1700’s, he was at elementary school. Gauss was asked to find the sum of the numbers from 1 to 100. The question was assigned as “busy work” by the teacher. He amazed his teacher with how quickly he found the sum of the integers from 1 to 100 to be 5050. Gauss recognized he had fifty pairs of numbers when he added the first and last number in the series, the second and second-last number in the series, and so on. For example:(1 + 100), (2 + 99), (3 + 98), ..., (50 + 51). Each pair has a sum of 101 and there are 50 pairs. History repeats itself. Jojo’s teacher assign a “busy work” to the students. The teacher believes that there will be no shortcut to finish this task in a minute. The teacher gives N integers A1, A2, ..., AN to the students. The teacher also gives Q questions. Each question contains two integers L and R asking the sum of all Ai where L <= Ai <= R. As a good friend of Jojo, help Jojo…
Chapter 1 Solutions
Programming and Problem Solving With C++
Knowledge Booster
Similar questions
- Write an algorithm to find the sum of n numbers. Calculate the timecomplexity of the same in terms of its basic operations.arrow_forwardWrite a computer algorithm (with python) for tabulating the resulting numbers.arrow_forwardWith a fancy calculator, finding square roots is easy. But what if you only had a basic four-function calculator? Assuming that number holds the value that you want to calculate the square root of, the following algorithm approximates the square root of a number: Get a guess from a human Square the guess If the squared guess is within 0.1 of the original number, we will accept the guess as our answer If it is not, try again with a different guess and keep trying until we get an answer that is close enough This algorithm relies on a human to make the guesses, though it wouldn't be too hard to also design an algorithm for making an appropriate guess. What would be a flowchart for this?arrow_forward
- The Apriori algorithm is a waste of time. Can you think of three things we could do to improve it?arrow_forwardThe following is an addition problem in binary notation. Each letter represents a unique binary digit. Which letter represents 1 and which represents 0? Design an algorithm for solving problems like this. YXX+ XYX=XYYYarrow_forwardWrite an algorithm to count how many integers from 1 to n (where n is inputted by the user) are not perfect squares, perfect cubes, or perfect fifth powers.arrow_forward
- A number is divisible by 11 if the difference of the sum of its digits at odd places and the sum ofits digits at even places is either 0 or divisible by 11.For example, for 2547039:(Sum of digits at odd places) - (Sum of digits at even places) = (9 + 0 + 4 + 2) - (3 + 7 + 5) = 0So 2547039 is divisible by 11.But for 13165648:(Sum of digits at odd places) - (Sum of digits at even places) = (8 + 6 + 6 + 3) - (4 + 5 + 1 + 1) = 1212 is not divisible by 11 so 13165648 is also not divisible by 11.arrow_forwardOne way to do multiplication is by repeated addition. For example, 47 x 25 can be evaluated as 47 +47 +47 +...+47 (25 times). Sketch out an algorithm for multiplying two positive numbers a and b using this technique.arrow_forwardTake the floor of a floating point number to the nearest tenth. It should work for any number, positive or negative (or zero). floor(3.14) → 3.1 floor(6.28) → 6.2 floor(-0.414) → -0.5arrow_forward
- Show how the letters A, B, and C can be turned into decimal numbers. A.arrow_forwardThe Problem A Zeckendorf number is defined for all positive integers as the number of Fibonacci numbers which must be added to equal a given number k. So, the positive integer 28 is the sum of three Fibonacci numbers (21, 5, and 2), so the Zeckendorf number for k = 28 is three. Wikipedia is a satisfactory reference for our purposes for more details of the Zeckendorf and Fibonacci numbers. In both cases, you do not need to read the entire Wikipedia entry. Your assignment is to write two ARM assembly language functions which calculate Zeckendorf and Fibonacci numbers. Zeck function The first function, which should be named zeck, receives an integer parameter in register zero. This will be the variable k we discussed above. Your code should return the Zeckendorf number for k in register zero when complete. If the parameter k is zero, return zero. If the parameter k is negative, return minus 1. If the parameter k is too large to calculate, return minus 1. Fib function The other function,…arrow_forwardWrite a program in Python to find the even numbers that are divisible by 6 and 9 and are between 2346 and 34.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education