Download presentation
Presentation is loading. Please wait.
Published byMoses Singleton Modified over 8 years ago
1
Even more problems.
2
Mean (average) I need a program that calculates the average of student test scores. I need a program that calculates the average of student test scores. 1. The program should prompt for test scores (0..100) until a special/crazy score (999) is entered. The program should then stop asking for more test scores. The program should then stop asking for more test scores. 2. It should then report the average (but not include the crazy 999 in the calculation).
3
Babylonian algorithm for square root of n (revisited) Steps: 1. Make a guess at the answer (you can pick n/2 as your initial guess). 2. Compute r = n / guess. 3. Set guess = (guess+r) / 2. 4. Go back to stop 2 for as may iterations as necessary. The more you repeat steps 2 and 3, the closer guess will be to the square root of n. Write a program that inputs n, iterates through the algorithm K times, and outputs the answer.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.