2) Write an algorithm that, given a list of real numbers a1, a2, · · · , an outputs the number of ai that lie between 90 and 100. discrete math
Added by Mary A.
Step 1
.., an of real numbers; we will count how many ai lie between 90 and 100 inclusive (i.e. 90 ≤ ai ≤ 100). If you want strict "between", replace ≤ by < in the comparisons. Show more…
Show all steps
Your feedback will help us improve your experience
Sri K and 66 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Consider the following algorithm in pseudocode. Suppose the input is the list of positive real numbers a1 = 1, a2 = 2, ..., a5 = 5, a6 = 6. procedure: whoknows(a1, a2, . . . , an: list of real numbers) s := 0 for i := 1 to n if ai is even, then s := s + ai return s (a) Show what the algorithm is doing for each value of i. [3 marks] (b) Describe in a brief sentence what the algorithm above does.
Sri K.
APPLIED DISCREET MATH 2.1 Given: a and b, where a < b, and x1 < x2 < ... < xn. Devise an algorithm to find all i : a ≤ xi ≤ b. What is the running time of the optimal
Adi S.
A computer routine selects one of the integers 1, 2, 3, 4, 5 at random and replicates the process a total of 100 times. Let S denote the sum of the 100 numbers selected. Calculate the approximate probability that S assumes a value between 280 and 320 inclusive.
Rashmi S.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD