+ 2
Quadratic equation
I tried it.. but the answers end up incorrect... I need help please
11 odpowiedzi
+ 6
@Sreejith did all the corrections. Here's a Java version.
https://code.sololearn.com/c4vyL0lAVxHa/?ref=app
https://code.sololearn.com/cFEUuPi5jVtr/?ref=app
+ 5
can you post the code
+ 3
this is what i did
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a, b , c
float x1;
float x2;
cout<< "Enter the a" << endl;
cin >> a;
cout << "Enter b" << endl;
cin >> b;
cout << "Enter c" << endl;
cin >> c;
cout << "Your a, b and c is " << a << b << c << "Respectively"<< endl;
x1 = (b*b) - sqrt( (b*b) - (2*a*c) / (2*a)
x2 = (b*b) + sqrt( (b*b) - (2*a*c) / (2*a)
cout << "The first root of the quadratic equation is " << x1 << endl;
cout << "The second root of the quadratic equation is "<< x2 << endl;
return 0;
}
+ 2
Well, I would love to help but I need to know the problem exactly. Any code or anything lol?
+ 2
quadratic equation formula
(-b +-√b^2 - 4ac ) / 2a
now in your code whats that b*b in the beginning
+ 2
Can we generalise to an n-power polynamial, like quintic, ^6, ^7, etcm
+ 1
Here's the corrected program
https://code.sololearn.com/cumXkegFG31r/?ref=app
+ 1
This is my code in Ruby:
https://code.sololearn.com/cW0jVY8ZNM42/#rb
Maybe something help
0
well that will get way too complicated.
0
@$Vengat you can use this to find root of any form of equation. But only one root.
https://code.sololearn.com/cUSS7rcnePZ1/?ref=app