#include
#include
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
char x;
int equation = a*x^2 + b*x + c;
int roots = (-b + sqrt((b^2 )- (4*a*c))/2*a , (-b - sqrt(b^2)- (4a**c))/2*a;
cout<<roots<<endl;
}
#include
#include
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
char x;
int equation = a*x^2 + b*x + c;
int roots = (-b + sqrt((b^2 )- (4*a*c))/2*a , (-b - sqrt(b^2)- (4a**c))/2*a;
cout<<roots<<endl;
}
hello @anuragsen9617
here u cant store two numbers in single variable.
so use two different variable.
also before calculating roots , u need to check its discriminant , whether it is non negative or not.
if negative then root wil not exisit .
for other case root exist
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.