أكتب برنامج لايجاد معادلة من الدرجة الثانية
- برمجة
- برمجة سي بلس بلس
- 2021-04-14
- salsabeelalhams99111801528
الأجوبة
#include<iostream>
#include<cmath>
using namespace std;
int main(){
double a,b,c,d,x1,x2;
cout<<"enter a,b,c:"<<endl;
cin>>a>>b>>c;
if(a==0){
x1=-c/b;
cout<<"the root is x1";}
else{d=b*b-4*a*c;
if(d<=0){
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(b))/(2*a);
cout<<"the roots are"<<x1<<x2;}
else
cout<<"no sultion";}
return 0;}