PROGRAMME wich solve EQUATION OF THE SECOND DEGREE | SoloLearn: Learn to code for FREE!

0

PROGRAMME wich solve EQUATION OF THE SECOND DEGREE

#include <iostream> #include <cmath> using namespace std; int main (){ float a, b, c, d, x1, x2, x; cout << "a="; cin >> a; cout << "b="; cin >> b; cout << "c="; cin >> c; if (a != 0) { d =( b * b )- (4*a*c); if (d > 0) { x1 = (-b - sqrt(d)) / (2 * a); cout << "x1=" << x1; x2 = (-b + sqrt(d)) / (2 * a); cout << "x2=" << x2; } else if (d == 0) { x = -b / (2 * a); cout << "x=" << x; } else { cout << "no solution"; } } return 0; }

11/7/2019 5:31:36 PM

Lyes Abdellatif

0 Answers

New Answer