题解 | #求解立方根#
求解立方根
http://www.nowcoder.com/practice/caf35ae421194a1090c22fe223357dca
#include <stdio.h> #include <math.h> int main() { double n,m; double i=0.1; scanf("%lf",&n); if(n>0) { while(i*i*i<n) { i=i+0.01; } printf("%.1lf",i); } else { m=-n; while(i*i*i<m) { i=i+0.01; } printf("%.1lf",-i); } }