Take a look at the following algorithm: Input: x: real number Output: unstated procedure pl (x) If (x > 90), Return ("gr
Posted: Thu May 05, 2022 1:59 pm
Take a look at the following algorithm: Input: x: real number Output: unstated procedure pl (x) If (x > 90), Return ("great!") If (x <= 90 and x > 60), Return ("ok") If (x <= 60), Return ("not ok"). I a) What is returned by the algorithm on the input 78, i.e. x = 78? b) What is returned by the algorithm on the input 99, i.e. x = 99? 1.) 10 pts
Take a look at the following algorithm: Input: n: integer Output: unstated procedure p2 (n) S := 0 While n > 8: S :n x 5 + 1 n = n - 1 End-while Return (s) a) When will the while-loop stop? b) what is returned by the algorithm on the input 10, i.e. n = 10? Show/explain your steps. 2. 15 pts
Take a look at the following algorithm: Input: n: integer Output: unstated procedure p2 (n) S := 0 While n > 8: S :n x 5 + 1 n = n - 1 End-while Return (s) a) When will the while-loop stop? b) what is returned by the algorithm on the input 10, i.e. n = 10? Show/explain your steps. 2. 15 pts