forked from OxyNett/1_147_2020
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsoleApplication1.cpp
More file actions
35 lines (33 loc) · 963 Bytes
/
ConsoleApplication1.cpp
File metadata and controls
35 lines (33 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a;
double b;
double c;
double x;
cout << "vvedite a: ";
cin >> a;
cout << "vvedite b: ";
cin >> b;
cout << "vvedite c: ";
cin >> c;
if ((b * b - 4 * a * c) > 0) //Если дискриминант больше нуля
{
x = (-1 * b + sqrt(b * b - 4 * a * c)) / (2 * a);
cout << "pervyi koren = " << x << endl;
x = (-1 * b - sqrt(b * b - 4 * a * c)) / (2 * a);
cout << "vtoroi koren = " << x << endl;
}
if ((b * b - 4 * a * c) == 0) //Если дискриминант равен нулю
{
x = ((-1 * b) / (2 * a));
cout << "koren raven" << x << endl;
}
if ((b * b - 4 * a * c) < 0) //Елси дискриминант меньше нуля
{
cout << "diskriminant menshe 0, korney net" << endl;
}
return 0;
}