CS245 - CS II Spring 1997 LAB 9


Due by the end of lab(April 1, 1997):

Write a program that

  1. reads in numbers x and n from the keyboard,
  2. computes xn using the algorithm below,
  3. prints the result.
  4. allow the user to enter additional pairs of numbers


If n < 0, xn is 1/(x-n). x0 is 1. If n is positive and even, then xn = (xn/2)2. If n is positive and odd, then xn = xn-1x.