正在加载图片...
靳润昭C语言教程讲义 2001年2月17日 令2a 2 则x1=p+q X2-P-q 源程序如下 #include<math. h maino float a, b, c, disc, x1, x 2, p, q; scanf("a=%f, b=%f, c=%f, &a, &b, &c g=sqrt(disc)/(2*a) xI=p+q; x2=p-q printf("nxl=%5.2f\nx2=%05.2fin,, x1, x2) 第13页靳润昭 C 语言教程讲义 2001 年 2 月 17 日 第13页 令 a b ac q 2 4 2 − = , a b ac q 2 4 2 − = 则 x1=p+q x2=p-q 源程序如下: #include<math.h> main() { float a,b,c,disc,x1,x2,p,q; scanf(“a=%f,b=%f,c=%f”,&a,&b,&c); disc=b*b-4*a*c; p=-b/(2*a); q=sqrt(disc)/(2*a); x1=p+q;x2=p-q; printf(“\nx1=%5.2f\nx2=%5.2f\n”,x1,x2); }
<<向上翻页
©2008-现在 cucdc.com 高等教育资讯网 版权所有