float k,b,x,y;
城步網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,城步網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為城步上1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢,請找那個售后服務(wù)好的城步做網(wǎng)站的公司定做!
printf("請輸入k,b:");
scanf("%f%f",k,b);
printf("請輸入x:");
scanf("%f",x);
y=k*x十b;
printf("y=%f\n",y);
#include
void main()
{
int a,b,c,d;
printf("請輸入4個整數(shù):");
scanf("%d%d%d%d",a,b,c,d);
printf("4個整數(shù)的平均值為%0.3f\n",(a+b+c+d)/4.0);
}
/*
供參考!
*/
# include stdio.h
# include math.h
void calcu(double a,double b,double c);
int main(void)
{
double a, b, c;
char ch;
do
{
printf("請輸入一元二次方程的三個系數(shù):\n");
printf("a=\t");
scanf("%lf", a);
printf("b=\t");
scanf("%lf", b);
printf("c=\t");
scanf("%lf", c);
calcu(a,b,c);
printf("繼續(xù)(Y/y),輸入其他退出: ");
scanf(" %c", ch);
printf("\n");
} while ('y'==ch || 'Y'==ch);
printf("成功退出!\n");
return 0;
}
void calcu(double a,double b,double c)
{
double delta;
double x1, x2;
delta = b*b - 4*a*c;
if (delta 0)
{
x1 = (-b + sqrt(delta)) / (2*a);
x2 = (-b - sqrt(delta)) / (2*a);
printf("有兩個解,x1 = %lf, x2 = %lf\n", x1, x2);
}
else if (0 == delta)
{
x1 = x2 = (-b) / (2*a);
printf("有唯一解,x1 = x2 = %lf\n", x1, x2);
}
else
{
printf("無實(shí)數(shù)解!\n");
}
}
/*
在c++6.0中的運(yùn)行結(jié)果是:
-------------------------
請輸入一元二次方程的三個系數(shù):
a= 1
b= -3
c= 2
有兩個解,x1 = 2.000000, x2 = 1.000000
繼續(xù)(Y/y),輸入其他退出: y
請輸入一元二次方程的三個系數(shù):
a= 1
b= 1
c= 1
無實(shí)數(shù)解!
繼續(xù)(Y/y),輸入其他退出: y
請輸入一元二次方程的三個系數(shù):
a= 1
b= -2
c= 1
有唯一解,x1 = x2 = 1.000000
繼續(xù)(Y/y),輸入其他退出: n
成功退出!
--------------------------------
*/
當(dāng)前文章:C語言怎么得到函數(shù)的系數(shù) c語言求函數(shù)值
文章來源:http://muchs.cn/article34/doedppe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、用戶體驗(yàn)、網(wǎng)站制作、全網(wǎng)營銷推廣、網(wǎng)站建設(shè)、微信公眾號
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)