Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- setlocale (LC_ALL, ".ACP");
- float a, b, c;
- float D1, x1, x2, D2;
- cout << "Введите значения ab + bc + c = 0:" << endl;
- cin >> a >> b >> c;
- D1 = (b * b) - (4 * a * c);
- D2 = sqrt(D1);
- if (D2 > 0)
- {
- x1 = (-1 * (b + D2)) / (2 * a);
- x2 = (-1 * (b - D2)) / (2 * a);
- cout << "x1 = "<< x1 << endl;
- cout << "x2 = "<< x2 << endl;
- }
- else if (D2 = 0)
- {
- x1 = (-b + D2) / (2 * a);
- cout << "x1 = " << x1 << endl;
- }
- else if (D2 < 0);
- {
- cout << "Нет корней" << endl;
- }
- cin.get();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement