0
点赞
收藏
分享

微信扫一扫

P1024 一元三次方程求解


P1024 一元三次方程求解_枚举法


枚举法:

#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
double a,b,c,d;
int main()
{
double x;
scanf("%lf%lf%lf%lf",&a,&b,&c,&d);
for (x=-100;x<=100;x+=0.01)
{
if (fabs(a*x*x*x+b*x*x+c*x+d)<=0.00001)
printf("%.2f ",x);
}
}


举报

相关推荐

0 条评论