CPSC 170 PreLab 10
Postfix Expressions and Modular Arithmetic

  1. Convert each infix expression below to postfix:
    1. a + (b * (c - (d / e)))



    2. (((a + b) * c) - d) / e



  2. Convert each postfix expression below to infix.
    1. a b c d e f + * - / %



    2. a b c d + * e f - / %



  3. Use a stack to evaluate the postfix expression below. Show your work.

    50   20   5   -   2   1   +   *   -











  4. Evaluate each expression below.
    1. (3 + 5) % 6

    2. (4 * 2 + 3) % 5

    3. ((n-1) + 2) % n, n > 2