#include#includevoid main(){double y,x,n;n=1;printf("Enter x(x>1)\n");scanf("%f",&x);for(y=1;y>=0.000001;n++){ y=y+(1/pow(x,n));printf("%f\n",y);}}
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/15 06:16:10
#include#includevoid main(){double y,x,n;n=1;printf("Enter x(x>1)\n");scanf("%f",&x);for(y=1;y>=0.000001;n++){ y=y+(1/pow(x,n));printf("%f\n",y);}}
#include
#include
void main()
{
double y,x,n;
n=1;
printf("Enter x(x>1)\n");
scanf("%f",&x);
for(y=1;y>=0.000001;n++)
{ y=y+(1/pow(x,n));
printf("%f\n",y);}
}
#include#includevoid main(){double y,x,n;n=1;printf("Enter x(x>1)\n");scanf("%f",&x);for(y=1;y>=0.000001;n++){ y=y+(1/pow(x,n));printf("%f\n",y);}}
// 程序改了,看后面的注释
#include<stdio.h>
#include<math.h>
void main()
{
double y,x,n;
n=1;
printf("Enter x(x>1)\n");
scanf("%lf",&x); // 你上面定义的是 double 类型,函数内要改成 %lf
for(y=1;y>=0.000001;n++)
{ y=y+(1/pow(x,n));
printf("%lf\n",y);} // 你上面定义的是 double 类型,函数内要改成 %lf
}