當前位置:編程學習大全網 - 編程軟體 - 壹維二次規劃

壹維二次規劃

# include & ltstdio.h & gt

# include & ltmath.h & gt

int main()

{

雙a,b,c,圓盤,p,q,x1,x2;

scanf("%lf%lf%lf ",& amp壹,& ampb & amp;c);

disc = b * b-4 * a * c;

如果(a!= 0)

{

if(disc & lt;0)

printf(" \ n ");

其他

{

p =-b/(2.0 * a);

q = sqrt(disc)/(2.0 * a);

x 1 = p+q;

x2 = p-q;

if(disc & gt;0)

printf("%f%f\n ",x1,x2);

else printf("%f\n ",x 1);

}

}

else if(b == 0)

{

如果(c == 0)

Printf("有無窮多個解\ n ");

其他

Printf("無解\ n ");

}

其他

{

x 1 =-c/b;

printf("x =%f\n ",x 1);

}

返回0;

}

  • 上一篇:wxpython怎麽開發樹型控件的復選框
  • 下一篇:米蘭理工大學有哪些熱門專業推薦就讀?
  • copyright 2024編程學習大全網