What will be the value of s if n = 127 is given as input to the following…
What will be the value of s if n = 127 is given as input to the following pseudocode?
Read n
i = 0, s = 0
Function Sample(int n)
while (n > 0)
r = n % 10
p = 8^i
s = s + p*r
i++
n = n / 10
End While
Return s
End Function- A.
27
- B.
187
- C.
87
- D.
120
Attempted by 35 students.
Sign up free to check your answer
Sign up freeLoading lesson…