简单实现x的n次方.c 124 B

12345678
  1. double mypow(double x, int n) {
  2. int i;
  3. double result = 1.0;
  4. for(i = 1; i <= n; i++) {
  5. result *= x;
  6. }
  7. return result;
  8. }