In the pseudocode below what is Q after execution V 7 Q V
In the pseudocode below, what is Q after execution.
V = 7
Q = V
R = V - 1
DOFOR K = 1, R
Q = Q*(V – K)
ENDDO
Solution
In the pseudocode below----->
V = 7
Q = V = 7
R = V - 1 = 7 - 1 = 6
DOFOR K = 1, R = 1, 6
Q = Q*(V – K) = 42, 210, 840, 2520, 5040, 5040
ENDDO
So Q after execution is----->5040
