In the following algorithm X,Q and R are integers. What numbers areprinted put b
ID: 3610936 • Letter: I
Question
In the following algorithm X,Q and R are integers. What numbers areprinted put by the algorithm?1. X is assigned the value 8
2. Whi;e(X is not equal to zero) do
2.1 R is assigned the value of the remainder obtained on dividing Xby 2
2.2 Q is assigned the value of the quotient obtained on dividing Xby 2.
2.3 Print R.
2.4 X is assigned the value of Q.
3. End of the While Loop
4. Halt
Part 2 question
Suppose that the line
2.4 X is assigned the value of Q
is replaced by the line
2.4 C is assigned the value of R
What numbers are printed put by the resulting algorithm?
Explanation / Answer
OUTPUT: If X=8, then the output is: 0 0 0 1 part2: If X is assigned the value of R: Then the output is: 0
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.