Даны действительные числа a, b, c ( a=0). Выяснить, имеет ли уравнение ax2 + bx +c = 0 действительные корни. Если действительные корни имеются, то найти их. В противном случае должно выдаваться сообщение, что корней нет — C++(Си)

#include <iostream>
#include <math.h>
using namespace std;
 
int main(){
double a,b,c,D,x1,x2;
do
{
 cout<<"a= ";
 cin>>a;
}while(a==0);
cout<<"b= ";
cin>>b;
cout<<"c= ";
cin>>c;
D=b*b-4*a*c;
if (D>0)
{
 x1=(-b+sqrt(D))/2*a;
 x2=(-b-sqrt(D))/2*a;
 cout<<"x1= "<<x1<<endl<<"x2= "<<x2<<endl;
}
else cout<<"Error!";
system("PAUSE");
return 0;}

59 Thoughts to “Даны действительные числа a, b, c ( a=0). Выяснить, имеет ли уравнение ax2 + bx +c = 0 действительные корни. Если действительные корни имеются, то найти их. В противном случае должно выдаваться сообщение, что корней нет — C++(Си)”

  1. Your site’s position in the search results https://ztd.bardou.online/adm

  2. Here’s what I can offer for the near future https://ztd.bardou.online/adm

  3. Your site’s position in the search results http://myngirls.online/

  4. Your site’s position in the search results http://fertus.shop/info/

  5. Here’s what I can offer for the near future http://fertus.shop/info/

  6. How to contact the administrator on this issue http://fertus.shop/info/

Leave a Comment