https://pintia.cn/problem-sets/12/problems/353
1 double calc_pow(double x, int n) 2 { 3 double ret; 4 5 if (n == 0) 6 { 7 ret = 1; 8 } 9 else 10 { 11 ret = x * calc_pow(x, n - 1); 12 } 13 14 return ret; 15 }
2024-04-03 19:18:28
https://pintia.cn/problem-sets/12/problems/353
1 double calc_pow(double x, int n) 2 { 3 double ret; 4 5 if (n == 0) 6 { 7 ret = 1; 8 } 9 else 10 { 11 ret = x * calc_pow(x, n - 1); 12 } 13 14 return ret; 15 }
下一篇:Python学习笔记之递归函数