Consider the following algorithm which uses an integer variable n.
1. Double the value of n
2.Add 34 to the answer
4. Round the answer to the nearest ten
5. Sum the digits of the answer
6. Display the final answer
Which of the following statements best describes the predictability of the results when this algorithm is run on a computer?
A) It is impossible to predict the value of the answer displayed, even if the value of n is known.
B) The answer displayed by the algorithm can be predicted for some values of n, but not for others.
C) The answer displayed by the algorithm for any known value of n can always be predicted.
D) The algorithm always displays the same answer, regardless of the value of n.
Answers
Answered by
0
Answer:
Explanation:
The answer displayed by the algorithm can be predicted for some values of n, but not for others.
Answered by
1
Option c) The answer displayed by the algorithm for any known value of n can always be predicted.
The following algorithm which uses an integer variable n.
Explanation:
one integers must be entered by the user.
Example:
n=2
double the value of n.
n=2*2
=4
add 34 to the answer
34+4=38
Round the answer to the nearest ten
=38(rounded nearest 10)
=40
Sum the digits of the answer
=4+0
=4
Display the final answer
=4
Hence, The answer displayed by the algorithm for any known value of n can always be predicted.
#SPJ3
Similar questions