Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote