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
  1. A.

    27

  2. B.

    187

  3. C.

    87

  4. D.

    120

Attempted by 35 students.

Sign up free to check your answer

Sign up free

Explore the full course: C Language

Loading lesson…