<math.h>
头文件中。double cbrt(double x);
#include <stdio.h> #include <math.h> int main() { double numbers[] = {27.0, 8.0, -27.0, 0}; double result; for(int i = 0; i < 4; i++) { result = cbrt(numbers[i]); printf("cbrt(%.2f) = %.2f\n", numbers[i], result); } return 0; }输出结果为:
cbrt(27.00) = 3.00
cbrt(8.00) = 2.00
cbrt(-27.00) = -3.00
cbrt(0.00) = 0.00
本文链接:http://task.lmcjl.com/news/5159.html